SHORT: How do I explicitly set the current working directory?
LONG: So I have 52 programs daisy chained together. I have a shell script pipeline that works great. Only problem is I can only run it if I cd into the directory with the files and run it. Some of the sub-programs do not have a mechanism that allows me to explicitly set output directories. They dump everything into the current working directory. This is fine if you are running 1 instance of this pipeline, but not so great if you are trying to process a dozen data-sets one after another. I know I can get the current working directory with:
echo $PWD
But how do I set it?
You can set the current dirctory for individual programs in your pipeline without affecting the other program in your pipeline like this:
In general, you can set any environment variable using that syntax. Here is a real example I tried in bash: