self-exec.sh
来自「一本完整的描述Unix Shell 编程的工具书的所有范例」· Shell 代码 · 共 20 行
SH
20 行
#!/bin/bash# self-exec.shechoecho "This line appears ONCE in the script, yet it keeps echoing."echo "The PID of this instance of the script is still $$."# Demonstrates that a subshell is not forked off.echo "==================== Hit Ctl-C to exit ===================="sleep 1exec $0 # Spawns another instance of this same script #+ that replaces the previous one.echo "This line will never echo!" # Why not?exit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?