This answer gave me
cd - as shorthand to change to my previous directory in Bash. It does have a major problem: it prints the directory it changes to, wasting my screen space, as that directory is then repeated in the prompt on the next line.
I know I can do
cd $OLDPWD, also mentioned in that answer, and
cd - >/dev/null but that is much more typing.
bash man page it says:
... or if - is the first argument, and the directory change is successful, the absolute path name of the new working directory is written to the standard output.
How can I make
- not to be the first argument? By using any of the
cd optional arguments? Any other way to suppress the echo or minimise typing without the need for defining functions/aliases on every machine I work with?