第一个登录进程名称似乎设置为-bash
,但是如果我使用subshell,它将变为bash
。例如:
root@nowere:~# echo $0
-bash
root@nowere:~# bash
root@nowere:~# echo $0
bash
-bash
导致某些脚本失败,例如 . /usr/share/debconf/confmodule
exec /usr/share/debconf/frontend -bash
Can't exec "-bash": No such file or directory at /usr/share/perl/5.14/IPC/Open3.pm line 186.
open2: exec of -bash failed at /usr/share/perl5/Debconf/ConfModule.pm line 59
有人知道为什么$0
设置为-bash
吗?
如果echo $0
命令的输出是,-bash
则表示该命令已bash
作为登录外壳程序调用。man bash
在第126行的某处说:
A login shell is one whose first character of argument zero is a -, or one started with the --login option.
在此处查看更多信息:Login Shell和Non-Login Shell之间的区别。
因此您的shell仍然是静止的/bin/bash
(可以通过echo $SHELL
命令检查),我建议您使用该命令,该命令通常会给您带来错误:
exec /usr/share/debconf/frontend bash
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句