📄 spawn.sh
字号:
#!/bin/bash# spawn.shPIDS=$(pidof sh $0) # Process IDs of the various instances of this script.P_array=( $PIDS ) # Put them in an array (why?).echo $PIDS # Show process IDs of parent and child processes.let "instances = ${#P_array[*]} - 1" # Count elements, less 1. # Why subtract 1?echo "$instances instance(s) of this script running."echo "[Hit Ctl-C to exit.]"; echosleep 1 # Wait.sh $0 # Play it again, Sam.exit 0 # Not necessary; script will never get to here. # Why not?# After exiting with a Ctl-C,#+ do all the spawned instances of the script die?# If so, why?# Note:# ----# Be careful not to run this script too long.# It will eventually eat up too many system resources.# Is having a script spawn multiple instances of itself#+ an advisable scripting technique.# Why or why not?
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -