Well... I know Neo is going to bust my chops for this
but you did try somthing and you need a little
direction so here goes...
OK. The first thing you should do in all shell scripts is to
set up the execution environment. You do this by inserting
the following line as the very first line in your script
(without the comments)...
#!/bin/sh <- Bourne Shell (normally)
...or
#!/bin/ksh <- Korn Shell
...or
#!/bin/csh <- C Shell
...remember that $* expands to ALL the positional parameters.
You need to read each one into a variable...
for prog in $*
do
... now, each time through the loop, $prog contains the next
positional parameter. Next, you want to check $prog for
"ordinary file" AND "executable file"...
if [ -f $prog -a -x $prog ]
then
...
else
...
fi
...then end your "do/done" loop and exit
done
exit 0
...just FYI, it's good programming practice to return some
sort of value (0 = AOK, 255 = Error) although this is a personal
preference.
You can then run this script in the background...
myscript /bin/ls /usr/bin/stat /bin/df ./myprog &
...you get the picture.