On 03/19/2014 08:28 AM, Eric Blake wrote:
> $ dash -c 'set 1 2 3; echo ${@: -1}'
> dash: 1: Bad substitution
> 
> If you want the last argument, you'll have to do something hideous like:
> 
> eval \${$#}
> 
> Short of using eval, there is no portable way to get at the last
> positional argument in dash.

If you are sure you don't need the other positional arguments, you could
avoid eval with:

shift $(($# - 1)); echo $1

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to