News for hackers. Stuff that matters.
Re:The Linux Commands HandBook by 29athrowaway on Thursday November 05, 2020 @03:06AM (#24996462)
pushd and popd. Thank me later.
Re:The Linux Commands HandBook by LeonM on Thursday November 05, 2020 @06:46AM (#24997399)
Weird, my Ubuntu 20 install does not have man pages on pushd and popd. Are these commands be specific to bash?

Anyway, since we are on the topic of directory navigation, I'd like to introduce 'cd -' (toggle to previous dir). Thank me later :-)

Re:The Linux Commands HandBook by c2xlZXB5Cg on Thursday November 05, 2020 @09:25AM (#24998472)
https://www.youtube.com/watch?v=BJ0uHhBkzOQ

First example:

  type -a <something>
to discover what <something> is (or if it exists on your system)
Re:The Linux Commands HandBook by Fnoord on Thursday November 05, 2020 @07:46AM (#24997764)
They are shell-specific, yes. Fish also has it built-in.

Try man -a {pushd,popd} you can also use the man -k flag to find manpages, and see man man (or man --help) for more flags.

Re:The Linux Commands HandBook by rgrau on Thursday November 05, 2020 @08:05AM (#24997871)
zsh also has them.

Another neat way of wrapping code in pushd/popd is to use a subshell.

    (cd $dir
       do-stuff
    )
Oilshell ( https://www.oilshell.org/ ) has support for code blocks so you can:

    cd /tmp {
      do-stuff
    }
Re:The Linux Commands HandBook by roryrjb on Thursday November 05, 2020 @07:41AM (#24997720)
They are bash built-ins. They are documented in bash's man page.
Re:The Linux Commands HandBook by asicsp on Thursday November 05, 2020 @08:05AM (#24997878)
can also use `help pushd` to get manual only for that command ('help' is like 'man' for built-ins)
Re:The Linux Commands HandBook by LeonM on Thursday November 05, 2020 @11:24AM (#24999519)
This is what I needed. None of the man pages showed information on the bash functions. 'help' did the job.

Ironically, 'man help' yields no results.

Re:The Linux Commands HandBook by joombaga on Thursday November 05, 2020 @11:54AM (#24999757)
That's because `help` is also builtin. It's listed under "SHELL BUILTIN COMMANDS" in `man bash 1` (or use the non-obvious `help help`)
Re:The Linux Commands HandBook by yipbub on Thursday November 05, 2020 @08:29AM (#24998026)
Get docs for shell builtins with help. Eg: `help pushd`
Re:The Linux Commands HandBook by sceadu on Thursday November 05, 2020 @11:53AM (#24999751)
Also 'setopt autopushd' (and other related options) for zsh