Simple shell procedure

Jim Webb jrw at mtune.ATT.COM
Tue Jul 10 05:30:53 AEST 1990


In article <WIZARD.90Jul8205942 at chemstor.uoregon.edu>, wizard at 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 at 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!"



More information about the Comp.unix.questions mailing list