I am writing a shell script which runs pwd
command and uses its output for some others tasks performed by the script. The script is working totally fine when I go to the particular directory and run it. But when I am trying to run the script from some other location by giving the full path of the script, I am not getting the desired output as pwd
command gives current directory's path. How can I solve this issue? How can I write something that will hold correct irrespective of where I run the script from?
The same issue is being faced when I am using ..
to get to previous directory. I want the script to take path with respect to its location instead of path where the script is being run. Please let me know if there are some other details required.
Asked
Active
Viewed 125 times
0

user3379410
- 176
- 1
- 11