Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!emory!att!dptg!mtune!jrw From: jrw@mtune.ATT.COM (Jim Webb) Newsgroups: comp.unix.questions Subject: Re: Simple shell procedure Message-ID: <667@mtune.ATT.COM> Date: 9 Jul 90 19:30:53 GMT References: Distribution: comp Organization: AT&T BL Middletown/Lincroft NJ USA Lines: 29 In article , wizard@chemstor.uoregon.edu (KevinS) writes: ? ? Hello Netters, I have a need for a simple shell procedure that replaces ? a command line like : ? ? program < datafile.in > datafile.out ? ? So that all I have to do is type: ? ? shellprocedure datafile ? ? And the shell procedure will append the suffix ".in" (if the filename ? passed to the script doesn't already have it) and also append an ? ".out" to the filename used for the redirected output. ? ? Thanks ? ? ? Kevins@ori.org A one line approach: [ "${1?No datafile}" ] && exec program <`expr $1 : '\(.*\).in' \| $1`.in >`expr $1 : '\(.*\).in' \| $1`.out :-) -- Jim Webb "Out of Phase -- Get Help" att!mtune!jrw "I'm bored with this....Let's Dance!"