[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
thought:
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.
- Re: Use of $@, (continued)
- Re: Use of $@, alex xmb ratchev, 2023/02/21
- Re: Use of $@, Andreas Kusalananda Kähäri, 2023/02/21
- Re: Use of $@, Kerin Millar, 2023/02/21
- Re: Use of $@, Koichi Murase, 2023/02/21
- Re: Use of $@, Christof Warlich, 2023/02/21
- Re: Use of $@,
Greg Wooledge <=
- Re: Use of $@, Kerin Millar, 2023/02/21
- Re: Use of $@, alex xmb ratchev, 2023/02/21
- Re: Use of $@, alex xmb ratchev, 2023/02/21
- Re: Use of $@, Chris F.A. Johnson, 2023/02/21
- Re: Use of $@, alex xmb ratchev, 2023/02/21
- Re: Use of $@, Greg Wooledge, 2023/02/21
- Re: Use of $@, Greg Wooledge, 2023/02/21
- Re: Use of $@, alex xmb ratchev, 2023/02/21
- Re: Use of $@, Kerin Millar, 2023/02/21
- Re: Use of $@, Greg Wooledge, 2023/02/21