shell 脚本特殊字符

Ivan Lv6

$$ 代表当前运行进程的 pid
$# 代表传递给脚本的参数个数
$0/$1/$2/$3... 代表传递给脚本的第一, 第二, 第三…个参数, 包含文件名 ($0)
$? 最后一个命令执行的退出状态

exit status

exit code description example
0 successful ls
1 general error ls x
2 misuse of shell builtins ls x(assume x does not exist)
  • Title: shell 脚本特殊字符
  • Author: Ivan
  • Created at : 2026-06-24 00:00:00
  • Updated at : 2026-10-23 18:02:31
  • Link: https://ivanfan-van.github.io/2026/06/24/note-2-seed-044/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
shell 脚本特殊字符