sunfull 发表于 2018-8-25 09:45:18

shell 获取上一次命令最后参数

  要获取到上一条命令的最后一个参数
root@ubuntu:/shell# ls /etc/hosts /etc/passwd  
/etc/hosts/etc/passwd
  
root@ubuntu:/shell# echo $_
  
/etc/passwd
  上面传输了两个参数

[*]  /etc/hosts
[*]  /etc/passwd
  所以执行echo $_ 后就会输出/etc/passwd


页: [1]
查看完整版本: shell 获取上一次命令最后参数