If I'm in /home/whatever
and I run, say, $ bash /home/folder/subfolder/script1.sh
, how can I get /home/folder/subfolder into a variable? $0
or $(readlink -f $0)
give me the whole path and filename, i.e. /home/folder/subfolder/script1.sh, which isn't what I'm after. Thanks in advance.
Asked
Active
Viewed 22 times
0

Angus
- 137
- 8