[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use of $@

From: Greg Wooledge
Subject: Re: Use of $@
Date: Tue, 21 Feb 2023 07:39:37 -0500

On Tue, Feb 21, 2023 at 01:34:37PM +0100, Christof Warlich wrote:
> $ index() { local e="$1"; shift; for i in "${!@}"; do [[ ${!i} != $e ]]
> || { echo $i; break; }; done; }
> $ LANG=C index "xx yy" "${myarray[@]}"
> bash: a bc xx yy z: invalid variable name
> Can anyone spot what's wrong?

I don't know what "${!@}" does, but clearly it doesn't do what you

unicorn:~$ set -- a bc; printf '<%s>\n' "${!@}"
bash: a bc: invalid variable name

It looks like it has no use whatsoever, given that it bombs out on
arbitrary inputs.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]