Minimal effort to reproduce what I am looking for, is as follows/$ sleep 1h &[1] 6564/$ cd~$ jobs[1]+  Running                 sleep 1h &  (wd: /)When I use jobs to manage my background processes, the working directory (wd) is also displayed when it is different from the current directory.Is there an easy way to easily change into this displayed work directory? I am using bash 3.2.I am not looking for wrapper functions using awk or similar tools, I am specifcally looking for a shell built in solution.
Quick access to work directory of background job
bash;directory;background process;cd command;jobs
If your intent is to get the working directory of a process, this is one way:~  jobs -l[1]  + 14308 running    sleep 1h~  readlink /proc/14308/cwd/home/matti-nilluThe following function inside .bashrc, will do exactly what you wantcdjob () {     pid=$(jobs -p $1);    d=$(readlink /proc/$pid/cwd);    cd $d}Example:~$ sleep 1h &[1] 15102~$ jobs[1]+  Running                 sleep 1h &~$ cd //$ cdjob %1~$ 