Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须按用户运行脚本。该用户的外壳已更改为/script/script1文件中/etc/passwd。当我运行脚本时,它会将 SHELL 作为 /script/script1。
/script/script1
/etc/passwd
啊,现在我看到脚本和 passwd 条目,我想我明白发生了什么。sem 正在尝试使用您的 shell 执行您的命令行。如果您在 sem 之前 printenv,您是否看到 SHELL=home/bkup:/script/script1?
如果是这样,那么只需在运行 sem 之前在行上导出 SHELL=/bin/bash (或 /bin/sh 等)
如果这不起作用,请向我们展示 printenv 的输出。