$0  –  Command Name

$0 is the name of the currently executed command. If a function is executed, then $0 is the name of the script.

Bash 5.0 and later allows modifications of $0 via BASH_ARGV0. Values assigned to BASH_ARGV0 automatically apply to $0.

Examples

Print command name
1
echo $0
BashSupport Pro 是一款 Bash 和 POSIX 集成开发环境,支持 $0 - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款