Why does ksh allow unpaired quotes while bash does not?

邮差的信 提交于 2019-12-04 03:38:42

In the Korn shell, both back ticks and quotes can be left unmatched, the tokenizer will try and guess where either will end and match them accordingly.

Examples:

/home/ufierro # echo "`echo ah" 
+ echo ah
+ echo ah
ah

/home/ufierro # echo `echo 'hello world` 
+ echo 'hello world'
+ echo hello world
hello world

Notice how both examples show a different case for the behavior mentioned above. The first example shows how, a single back tick within double quotes was completed during parsing and the second example shows how a single quote inside back ticks was completed as well.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!