Linux-登录服务器报/etc/profile.d/system-info.sh:8l:= not found

Linux-登录服务器报/etc/profile.d/system-info.sh:8l:= not found

一、问题:

image

二、根因:

系统默认行为:Linux发行版(如OpenEuler/CentOS等)通常会在/etc/profile.d/目录下放置这类脚本,用于统一管理登录时的环境变量和提示信息。
双等号问题:
在标准的 test 或 [ ] 条件判断中,应该使用单等号 = 而不是 ==
== 是 Bash 扩展语法,在某些精简版 shell 中不被支持

三、解决:

if [ "$whoiam" == "root" ]
改为
if [ "$whoiam" = "root" ]
posted @ 2025-05-26 10:27  skystrivegao  阅读(26)  评论(0)    收藏  举报