我有一个名为-.
我想显示它的内容。
一种方法是做
cat ./-
Run Code Online (Sandbox Code Playgroud)
因为cat -从标准输入读取。但是,为什么cat "-"和cat '-'还解释由shell作为cat -?
引号由 shell 使用,而不是传递给命令:
例如
cat "hello world" #this passes the single token `hello world`, to `cat`, as argument 1. However the quotes are not passed.
cat "-" # this passes the single token `-`, to `cat`, as argument 1. The same as if no quotes had been used.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
685 次 |
| 最近记录: |