"send command" 和 "send -- command" 之间的期望有什么区别
what is the difference in expect between "send command" and "send -- command"
我看到一些例子,其中发送命令是用 send "echo test"
之类的东西发送的,在其他地方我看到 send
后跟 --
。有什么区别?
send --
用于发送以 -
开头的字符串,以防它可能被解释为 send
的选项。
来自manual:
The --
flag forces the next argument to be interpreted as a string rather than a flag. Any string can be preceded by --
whether or not it actually looks like a flag. This provides a reliable mechanism to specify variable strings without being tripped up by those that accidentally look like flags. (All strings starting with -
are reserved for future options.)
我看到一些例子,其中发送命令是用 send "echo test"
之类的东西发送的,在其他地方我看到 send
后跟 --
。有什么区别?
send --
用于发送以 -
开头的字符串,以防它可能被解释为 send
的选项。
来自manual:
The
--
flag forces the next argument to be interpreted as a string rather than a flag. Any string can be preceded by--
whether or not it actually looks like a flag. This provides a reliable mechanism to specify variable strings without being tripped up by those that accidentally look like flags. (All strings starting with-
are reserved for future options.)