$@ in alias inside script: is there a "local" $@?
0
votes
1
answer
106
views
I have aliased
pushd
in my bash shell as follows so that it suppresses output:
alias pushd='pushd "$@" > /dev/null'
This works fine most of the time, but I'm running into trouble now using it inside functions that take arguments. For example,
test() {
pushd .
...
}
Running test
without arguments is fine. But with arguments:
> test x y z
bash: pushd: too many arguments
I take it that pushd
is trying to take . x y z
as arguments instead of just .
. How can I prevent this? Is there a "local" equivalent of $@
that would only see .
and not x y z
?
Asked by Théophile
(103 rep)
Aug 15, 2019, 06:41 PM
Last activity: Aug 15, 2019, 07:36 PM
Last activity: Aug 15, 2019, 07:36 PM