help-bash
[Top][All Lists]
Advanced

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

Re: Use of $@


From: Koichi Murase
Subject: Re: Use of $@
Date: Tue, 21 Feb 2023 20:06:24 +0900

2023年2月21日(火) 19:28 Christof Warlich <cwarlich@gmx.de>:
> as expected. The only thing that bothers me is that I couldn't get away
> without the intermediate assignment of $@ to a new array (a): Is there
> really no way to avoid that, i.e. directly using $@ in the for-loop?

It is easy to rewrite the shell function `index' using shift as
Andreas suggests, but I assume your true question is about the way to
access $@ with a specified index. You can use ${!i}. Or if you would
like to extract multiple words in a range, you can use
"${@:i:length}".

--
Koichi



reply via email to

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