I can use -cwd flag in the script to specify that the script directory is also the job working directory. So I basically have two options:
- specify
-cwdand set the script directory as the job directory - omit
-cwdand do not explicitly set job directory
In the latter case, my job is run in directory specified by my $HOME value.
My question is how can I specify job working directory. For example, suppose I have the following directory:
|main----------|sub----mydata.txt
|--myscript.sh
With the contents of my script being:
#!bin/bash
tail mydata.txt -n 1 > output.txt
If I specify flag -cwd then the job will fail - since there is no mydata.txt in my main directory - it's found in directory named sub. I've tried adding the following commands before my main command:
export $HOME=main/sub
But it still does not work.
Use the -wd option. No c required.