shell(十三)参数代换

Posted zhanglong71

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell(十三)参数代换相关的知识,希望对你有一定的参考价值。

shell参数代换xargs. 产生命令的参数

  1. cut -d \':\' -f 1 /etc/passwd | head -n 3 | xargs finger

  

  2. 执行前询问用户

  cut -d \':\' -f 1 /etc/passwd | head -n 3 | xargs -p finger

  如果直接按回车就退出

  

  3. 指定查阅参数个数

  cut -d \':\' -f 1 /etc/passwd | xargs -p -n 5 finger

  

  4. 指定遇到某字符串就结束

  cut -d \':\' -f 1 /etc/passwd | xargs -p -e\'deamon\' finger

  

  5. 不支持管道的情景

  xargs对于不支持管道的命令特别有用

  

  下面的命令显示不是想要的结果

  

以上是关于shell(十三)参数代换的主要内容,如果未能解决你的问题,请参考以下文章