微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

bash – 这个shell命令中“ – ”(双破折号)是什么意思?

我有这个 shell命令:
kill `cat -- $PIDFILE`

双重的是什么?为什么不直接使用

kill `cat $PIDFILE`
– 告诉cat不要尝试解析它后面的命令行选项.

例如,如果变量$PIDFILE被定义为PIDFILE =“ – version”,请考虑在两种情况下会发生什么.在我的机器上,它们给出以下结果:

$cat $PIDFILE
cat (GNU coreutils) 6.10
copyright (C) 2008 Free Software Foundation,Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY,to the extent permitted by law.

Written by Torbjorn Granlund and Richard M. Stallman.

$cat -- $PIDFILE
cat: --version: No such file or directory

原文地址:https://www.jb51.cc/bash/385995.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐