Echo ' $ Get the file name of the currently executing shell script: ' $
Echo ' $n gets the nth parameter value of the currently executing shell script: ' $ ' =$1 ' $ =$2 ' $ ' =$3
Echo ' $* gets all the parameters of the currently executing shell script: ' $*
Echo ' $ #获取当前执行的shell脚本的命令行中参数总个数: ' $#
Echo ' $$ Gets the process number (PID) of the currently executing shell script: ' $$
Sleep 2 &
Echo ' $! gets the PID that executes the previous instruction: ' $!
Echo ' $? Gets the return value of the last instruction executed: ' $?
Echo ' [email protected] Get all the parameters to take this program: ' [email protected]
Echo ' $_ The last parameter of the command or script executed before: ' $_
Linux before and after task switching method:
1, when the Linux terminal to run the command, at the end of the command to add & symbols, you can let the program run in the background
./TCPSERV01 &
2, if the program is running in the foreground, you can use the CTRL + Z option to suspend the program, and then use the BG%[number] command to put this program in the background to run
./tcpserv01
^z
[1]+ Stopped./tcpserv01
[Email protected]:~/unp/unpv13e/tcpcliserv$ bg%1
[1]+./TCPSERV01 &
[Email protected]:~/unp/unpv13e/tcpcliserv$
3, for all running programs, we can use the jobs–l command to view
[Email protected]:~/unp/unpv13e/tcpcliserv$ jobs-l
[1]+ 4524 Running./TCPSERV01 &
4, can also use FG%[number] command to drop a program to the foreground run
[Email protected]:~/unp/unpv13e/tcpcliserv$ FG%1
./tcpserv01
5, can also directly terminate the background running programs, using the KILL command
[Email protected]:~/unp/unpv13e/tcpcliserv$ kill%1
6,nohup Command, the original program's standard output is automatically redirected to the current directory of the Nohup.out file, played the role of log.
Nohup/root/start.sh &
Shell special variables and forward and backward task switching methods