I’m writing a shell script which performs some operation on files.
This script will run on various servers so I want to keep the path of these files from home directory.
DAT_FILE_PATH='$HOME/projs/build/dat'
I’m using ksh as shell.
The above path indeed exists. If I run cd in console
cd $HOME/projs/build/dat
This works. But in script if I do ls $HOME/projs/build/dat’. It says No such file or directory.
Similarly, If I use sed on $HOME/projs/build/dat/abc.dat, result is same.
Try double quotes
“The difference between single and double quotes becomes more important when you’re dealing with variables on the command line”
Go here for more details