bash 如何在不支持 ypchsh 的远程计算机中更改 Linux shell

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9942927/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 01:55:00  来源:igfitidea点击:

How to change Linux shell in a remote computer that does not support ypchsh

linuxbashshelltcsh

提问by Elan

How do I change shell in a remote PC? I am logged into a cluster with a Bash and the output I see is

如何在远程 PC 中更改外壳?我用 Bash 登录到一个集群,我看到的输出是

elan@l01:~ $ chsh
chsh: can only change local entries; use ypchsh instead.
elan@l01:~ $ ypchsh
-bash: ypchsh: command not found

Since I have no root privilege there, I can not install ypchsh in the cluster. Is there any other way to change shell without invoking ypchsh?

由于我在那里没有 root 权限,我无法在集群中安装 ypchsh。有没有其他方法可以在不调用 ypchsh 的情况下更改 shell?

Note 1: Browsing, it looks like another user who installed the same software (currently not available for questioning) has .cshrc in his directory, with the right settings. His .bashrc is minimal and has no redirections.

注意1:浏览,看起来另一个安装了相同软件的用户(目前无法提问)在他的目录中有.cshrc,并且设置正确。他的 .bashrc 是最小的,没有重定向。

The /etc/passwd has no entry for either of us.

/etc/passwd 没有我们任何人的条目。

getent passwd

shows entry for both of us, but shows only /bin/bash for both.

显示我们两个的条目,但只显示 /bin/bash 两个。

Note 2: The sofware has been developed with autotools, and using bash instead of tcsh is known to have created wrong builds. (I am not changing shell because I fancy it.)

注 2:该软件是使用 autotools 开发的,已知使用 bash 而不是 tcsh 会创建错误的构建。(我不会改变外壳,因为我喜欢它。)

Thank you, Elan

谢谢你,伊兰

回答by bos

In your .bashrc, put exec tcshlast.

在您的.bashrc,放在exec tcsh最后。

回答by CR Drost

Once you're in bash in the cluster, why don't you just type tcsh? And if that works, why not just add it as the last line of .bashrc?

一旦你在集群中的 bash 中,你为什么不直接输入tcsh?如果可行,为什么不将其添加为 的最后一行.bashrc