re-direction

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

case `uname` in
  SunOS) cmd=myprog_sun ;;
  Linux) cmd=myprog_lnx ;;
esac

$cmd < filein > fileout

Hhhmmm...that is not exactly what I am asking.

Let's say that the short script you show above is named "prog"...can you type

prog < infile > outfile

at the command line and works? I don't think so...so, what I attempted to describe is a request for code that transfers the options/arguments given to the wrapping script to a command inside the script....

The thing is that options/argument seem to stop being reported after the first re-direction, so, I can't see infile and outfile inside the shell...is this correct, or am I missing something.

Thanks,

gsal

I just found something somewhere else...don't quite understand it, but here it is

trap 'kill $!; exit 1' INT QUIT TERM

if [[ -t 0 ]] ; then
$cmd $*
else
tee /tmp/${somethingUniq}_in_data 1>/dev/null
$cmd </tmp/${somethingUniq}_in_data $* &
fi

pid=$!
wait $pid

# Preserve the exit status
EXITSTAT=$?
exit $EXITSTAT

gsal