Refer to the current directory in a shell script -
how refer current directory in shell script
so have script calls script in same directory
#! /bin/sh #call other script ./foo.sh # ... for got ./foo.sh: no such file or directory
so changed to:
#! /bin/sh #call other script foo.sh # ... but call foo script is, default, in path. not want.
so question is, what's syntax of doing './` in shell script?
if both scripts in same directory , got ./foo.sh: no such file or directory error cause ran first script different directory 1 located in. put following in first script call foo.sh works irrespective of call first script from:
my_dir=`dirname $0` #call other script $my_dir/foo.sh
Comments
Post a Comment