On Fri, May 27, 2011 at 3:45 PM, Greg Wooledge <wool...@eeg.ccf.org> wrote:

> On Fri, May 27, 2011 at 12:35:12PM -0700, Jacoby Hickerson wrote:
> >         When executing a test script using the #!/bin/sh interpreter line
> > the shell expansion for the last argument ${!#} is blank,
>
> Good.  And now you know why you use a proper #!/bin/bash shebang when
> you use bash extensions in your script.
>
> If you are using #!/bin/sh then you should use only POSIX sh features.
>
>
Indeed, indirection is a bash feature.  I wouldn't expect it to work in
POSIX sh.

The only way I can think of to get the last argument in sh is to loop
through them,
something like:
for arg; do last="$arg"; done; echo "$last"

Reply via email to