1
Zsh是一個非常強大的外殼,但有一段時間,我感到驚訝,因爲它走得太遠了。如何禁用zsh中的內聯函數定義
最近我已經輸入以下命令後,這些令人驚訝的令人費解的時刻之一(適用於簡單和清晰):
% echo "nosuchfunction() nosuchcommand"
nosuchfunction() nosuchcommand
% echo nosuchfunction() nosuchcommand
% echo "nosuchfunction() nosuchcommand"
echo:3: command not found: nosuchcommand
% echo I used to like this
echo:4: command not found: nosuchcommand
我花了一段時間來了解發生了什麼事情,並認爲這是特定於zsh而不是我嘗試執行的命令。在第2行,我創建了一些內聯函數,並將其分配給「echo」。至少,這是有道理的線3的輸出和4
作爲對比的光的唯一解釋,在bash事情讓多一點點的感覺:
% echo "nosuchfunction() nosuchcommand"
nosuchfunction() nosuchcommand
% echo nosuchfunction() nosuchcommand
bash: syntax error near unexpected token `('
% echo "nosuchfunction() nosuchcommand"
nosuchfunction() nosuchcommand
% echo I used to like this
I used to like this
在這一點上我我也不確定這應該是一個功能還是一個錯誤,但我只想禁用這種行爲。
任何人都知道如何?