解释:
  主要是Bash中已经定好的变量,名称不能自定义,作用也是固定的

$?
  最后一次执行的命令返回状态,0为成功,非0为失败
$$
  当前进程的进程号
$!
  后台运行的最后一个进程的进程号

例子:
[root@localhost sh]# ls
param_test2.sh param_test.sh
[root@localhost sh]# echo $?
0

[root@localhost sh]# lss
-bash: lss: command not found
[root@localhost sh]# echo $?
127

[root@localhost sh]# echo $$
8466

[root@localhost sh]# find /root -name hello.sh &
[1] 8700
[root@localhost sh]# echo $!
8700
[1]+ Done find /root -name hello.sh

相关文章:

  • 2021-08-17
  • 2021-05-18
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-31
  • 2021-05-16
  • 2022-02-22
  • 2021-10-20
  • 2021-05-18
  • 2021-06-28
  • 2021-08-31
相关资源
相似解决方案