我认为这些命令在 bash 中是等效的,但它们产生不同的输出。你能帮我理解为什么吗?
$ echo "SEBA" | wc
1 1 5
Run Code Online (Sandbox Code Playgroud)
$ wc <<< "SEBA"
1 1 5
Run Code Online (Sandbox Code Playgroud)
继续运行
这里有一些测试:
$ echo "SEBA" | wc | hexdump
0000000 2020 2020 2020 2031 2020 2020 2020 2031
0000010 2020 2020 2020 0a35
0000018
Run Code Online (Sandbox Code Playgroud)
$ wc <<< "SEBA" | hexdump
0000000 2031 2031 0a35
0000006
Run Code Online (Sandbox Code Playgroud)
$ echo "SEBA" | hexdump
0000000 4553 4142 000a
0000005
Run Code Online (Sandbox Code Playgroud)
$ hexdump <<< "SEBA"
0000000 4553 …Run Code Online (Sandbox Code Playgroud)