
June 11th, 2011, 09:39 PM
|
|
|
|
It's down to relative directories of where your current working directory is, not where the script you run is.
If the script (and it's config file) are in the same directory as each other and your shell is also in that directory (as shown with pwd and being able to run the script with ./test.sh) then the relative path of ./appl.properties will be found. When you go back one directory (so you need to use ./shell/test.sh) the config file is not longer in the current directory, so the ./ part of the relative path in your script will fail to find the file.
You can do things with the $0 variable and which and other such commands to find out the directory in which the command running resides, and hence the directory where the config file is.
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc
|