Say I open ~/vim.txt, push that to background, then cd to another path. When I bring that job to foreground, is there an option to switch back to old path? I noticed it says pwd, so I assume it is possible.
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
migrated from stackoverflow.com May 4 '11 at 20:49
|
This is possible in zsh, and in fact it's easy thanks to the direct access to the job parameters provided by the zsh/parameter module. You can use a job number or any job specification (
Bash also keeps track of the information, but I don't think it's exposed. On some systems, you can obtain the current working directory of the job's process, and switch to it. For example, on Linux,
Since it can also be useful, here's a zsh version. Unlike the function above, which switches to the job's original directory, this one switches to the current working directory of the job's process leader.
|
|||||||||
|