Quote:
Originally Posted by
disedorgue
For information, from my "solution" with shift command, it was on solaris 10 (/usr/bin/sh).
It is possible that a shopt or set -o option is missing ?
Regards.
Note that neither Solaris 10 /usr/bin/sh nor Solaris 8 /bin/sh or /usr/bin/sh (I thought it was /bin/sh on a Solaris 8 system, but it has been many years since I had access to a Solaris 8 system) is a Korn shell; they are Bourne shells. But both Bourne and Korn shells should be happy with ${12} when there are that many command line arguments no matter what shell options are enabled.
Of course you can use
shift 10 to access positional parameters 11 through 19 as $1 through $9, respectively, in a Bourne or Korn shell. But after the shift, the original positional parameters $1 through ${10} (if it worked) will no longer be available unless they were saved into other variables before the
shift 10. If ${10} isn't working and you need to access the 10th positional parameter, presumably you'd want to use
shift 9 rather than
shift 10 so you could process groups of 9 positional parameters at a time. Even after a shift, $0 should remain unchanged (but if ${11} doesn't work, I won't make any claims about how $0 will behave after any invocation of
shift).
Have you or pat_pramod tried running any of these scripts with /usr/xpg4/bin/sh or with ksh instead of using /usr/bin/sh or /bin/sh?