linux-tutorial/codes/shell/示例脚本/输入和输出/读取程序名.sh
2019-10-10 08:56:31 +08:00

11 lines
254 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# testing the $0 parameter
echo The command entered is $0
#当传给$0变量的真实字符串是整个脚本的路径是程序中就会使用整个路径而不仅仅是程序名
name=`basename $0`
echo The command entered is $name