($@) Expands to the positional parameters, starting from one.
How can I get the positional parameters, starting from two, or more generally, n
?
I want to use the positional parameters starting from two, as arguments to a command, for example,
myCommand $@
Best Answer
For positional parameters starting from the 5th one:
zsh
oryash
.(note, as always, that the quotes above are important, or otherwise each element would be subject to split+glob in
yash
, or the empty elements removed inzsh
).ksh93
,bash
orzsh
:(again, quotes important)
Bourne-like shells (includes all of the above shells)
(using a subshell so the shift only happens there).
csh-like shells:
(subshell)
fish
:rc
:(subshell)
rc
/es
:es
: