Original question:
=================
I have a line in my csh wrapper to start my program:
exec /usr/mri/master/bin/`basename $0` $*:q
How do I convert the above line to Korn shell and Bourne shell to pass
all the parameters to the command? One of my actual commands to call
xsh is:
xsh -t mri02
Solutions:
=========
Both of the following lines work (in ksh and sh):
exec /usr/mri/master/bin/`basename $0` "$@"
exec /usr/mri/master/bin/`basename $0` "${@:-}"
Added info from Vasu:
====================
as you know, using `basename $0` invokes another process, which is costly.
ksh provides parameter substitution constructs to do the equivalent. so a
better
way in ksh would be
exec /usr/mri/master/bin/"${0##*/}" "${@:-}"
${X##*/} represents,
$X with its longest prefix matching the pattern '*/' deleted
This is just a parameter substitution done inside ksh and does not invoke any
other process.
Vicky Lau