为什么我必须输入“\\\ 0”才能在zsh中创建一个字符串“\ 0”?
> echo 0
0
> echo
0
slu@dev:~
> echo
slu@dev:~
> echo " "
# <--- What!!?
slu@dev:~
> echo
slu@dev:~
> echo " "
slu@dev:~
> bash
Executing .bashrc
$ echo " "
$ echo " "
$ echo " "
我得说,bash的行为对我来说更有意义。
更多细节:
slu@dev:~
> echo "0" | hexdump -C
00000000 30 0a |0.|
00000002
slu@dev:~
> echo " " | hexdump -C
00000000 00 0a |..|
00000002
slu@dev:~
> echo " " | hexdump -C
00000000 00 0a |..|
00000002
slu@dev:~
> echo " " | hexdump -C
00000000 5c 30 0a | .|
00000003
slu@dev:~
> echo "\0" | hexdump -C
00000000 5c 30 0a | .|
00000003
slu@dev:~
> echo "\ " | hexdump -C
00000000 5c 00 0a |..|
00000003
slu@dev:~
> echo "\ " | hexdump -C
00000000 5c 00 0a |..|
00000003
slu@dev:~
> echo "\ " | hexdump -C
00000000 5c 5c 30 0a | .|
00000004
最大的问题是,在bash和zsh上都没有产生所需结果