/etc/profile.d/system-info.sh 的兼容性问题

/etc/profile.d/system-info.sh 出现问题的代码片段(第81-86行):

if [ "$whoiam" == "root" ]
then
    echo -e "\n"
else
    echo -e "To run a command as administrator(user \"root\"),use \"sudo <command>\"."
fi

问题复现:

zsh: = not found

修复建议:

if [ "$(whoami)" = "root" ]
then
    echo -e "\n"
else
    echo -e "To run a command as administrator(user \"root\"),use \"sudo <command>\"."
fi

1 Like