现诚聘英语写作老师,最好是在university of delaware学校附近,pay $30/hour, 要求:英语教育或相关专业的研究生或以上学历。 如有意者请邮件至i**[email protected] 或致电 786-206-3184
j*n
2 楼
While a sh script can access its own file name through $0, yet when a script is run from a dot command, $0 is not the name of the script, but rather the name of the command or script that runs the dot command. So the question: how does the script find its own file name when it is run from a dot command? Example: $ cat ./z echo $0 $ ./z ./z $ . ./z bash
${BASH_SOURCE} (assuming you are using bash, as the '.' built-in indicates)
the a
【在 j******n 的大作中提到】 : While a sh script can access its own file name through $0, yet when a : script is run from a dot command, $0 is not the name of the script, but : rather the name of the command or script that runs the dot command. So the : question: how does the script find its own file name when it is run from a : dot command? : Example: : $ cat ./z : echo $0 : $ ./z : ./z
S*Y
6 楼
小本很萌~
l*G
7 楼
The following works : #!/bin/bash filename=`basename $0` echo "script name is:" $filename