如果别名存在于 zsh 中,则将其删除
remove an alias if it exists in zsh
我正在尝试删除在 zsh 中设置为关键字 clear 的别名,但首先我想检查它是否存在。
这是我试过的:
if whence -w clear | grep "alias" then
unalias clear
fi
但我不知道如何使用 piline 的输出。
你忘记在grep "alias"
后面加分号了吗?以下在 zsh 中工作得很好。
% alias clear=something
% alias
clear=something
% if whence -w clear | grep "alias"; then
unalias clear
fi
clear: alias
% alias
%
我正在尝试删除在 zsh 中设置为关键字 clear 的别名,但首先我想检查它是否存在。 这是我试过的:
if whence -w clear | grep "alias" then
unalias clear
fi
但我不知道如何使用 piline 的输出。
你忘记在grep "alias"
后面加分号了吗?以下在 zsh 中工作得很好。
% alias clear=something
% alias
clear=something
% if whence -w clear | grep "alias"; then
unalias clear
fi
clear: alias
% alias
%