Say I have a single bin directory with Linux and SunOS executables, like this:
bin/myprog_lnx
bin/myprog_sun
Assume these programs read from stdin and write to stdout and, thus, are meant to be run like this:
myprog_lnx < filein > fileout
My users may log in from a Linux or Solaris client and I don't want to bother them with the suffix...I would like them to simply run the program like this:
myprog < filein > fileout
So, it occurs to me, that I could have a korn shell named "myprog" that when run, it checks for the OS and runs the appropriate executable...
Question: how can the arguments and re-direction typed at the command line after the shell script be passed to the command inside the shell script?
In other words, when I run my shell like this:
> myprog < filein > fileout
in Solaris, the shell should execute
myprog_sun < filein > fileout
when in Linux, the shell should execute
myprog_lnx < filein > fileout
==myprog====
#!/bin/sh
if [[ `uname` = 'SunOS' ]] ; then
suffix='_sun'
elif [[ `uname` = 'Linux' ]] ; then
suffix='_lnx'
fi
myprog${suffix} < filein > fileout <<< how to accomplish this effect???
==myprog====
Thanks in advance for any hints you may offer.
gsal