Sometimes shell commands behave unexpectedly because of subshells-processes.
A recent example I experienced was that this command won't work because xargs runs the cd
-command in a subshell:
ls | sort | tail -1 | xargs cd
Another one is that cd
doesn't work in Makefiles.
Is there a way to visualize which shells/subshells/processes do what in a (chained) command? I would like to get a better feeling for them.