On Fri, May 27, 2011 at 1:20 PM, DJ Mills <danielmil...@gmail.com> wrote:

>
>
> 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"
>

Ah I see that inderection is a bash specific feature, in general I should
update all my scripts.  Although, I am curious, is this is a matter of sh
being continually updated to exclude all bash extensions or perhaps
previously bash didn't interpret #!/bin/sh to be the POSIX compliant
interpreter?

Reply via email to