shell/处理用户输入/读取程序名.sh

10 lines
253 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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