I have a config file (not a script) that states where to find a file named key.dat. With this config, I need to operate on the key.dat, so I did the following...
$ cat myconfig
$ touch $mypath/key.dat # mypath is of course defined
$ KEYFILE=`grep '^keyfile=' myconfig | cut -d '=' -f 2`
$ echo $KEYFILE
$ [ -f $KEYFILE ] || echo 'Not Found'
Since '$mypath' is not expanded in the test, the key.dat is not found.
My question is, how can I make $mypath expanded in the test so that I can get hold of the file key.dat?