在我的程序中,我需要输出给用户他正在使用的shell。所以在文件/etc/udate-motd.d/00-header
我写了printf "$SHELL"
,但问题是,即使我将shell切换到zsh,$ SHELL仍然等于/ bin/bash。我通过互联网搜索,发现我可以通过使用MyShell='ps -hp $$'
,这里又是一个问题。当我使用它MyShell
是一个字符串与进程数(/etc/update-motd.d/00-header
也有),但没有字zsh
。获取Linux shell的名称
那么我该如何理解哪个shell使用这个日志呢?
[此问题](https://stackoverflow.com/questions/3327013/how-to-determine-the-current-shell-im-working-on)至少是密切相关的,如果不是重复的话。 – ajp15243 2014-09-30 17:51:05
@ ajp15243,非常感谢!找到它,对不起,重复:( – PepeHands 2014-09-30 17:54:44