Linux bash know the script path which includes library script -
this question has answer here:
- how know script file name in bash script? 19 answers
i have library script named , script b, c includes
. ../../../a the problem how can know time run ./b.sh or ./c.sh, example:
if(run ./b.sh) echo "b (file path) calling" else echo "c (file path) calling"
you can use $0 determine command executed:
a.sh:
echo $0 b.sh:
. ./a.sh when run:
$ sh b.sh b.sh $ sh a.sh a.sh it give command executed, not arguments:
$ sh b.sh 1 2 3 b.sh
Comments
Post a Comment