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
?
$@
at all? – Wildcard Aug 15 '19 at 18:57