从 tcsh 更改为 bash?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34371466/
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
Changing from tcsh to bash?
提问by Joe
I am having difficulty with some shell commands and think that it is due to a failure of my shell being set to BASH.
我在使用某些 shell 命令时遇到困难,并认为这是由于我的 shell 设置为 BASH 失败。
The following commands solve my problem:
以下命令解决了我的问题:
bash --login
Or simply by typing
或者简单地输入
bash
Therefore it seems that I need to reconfigure my shell to bash which should be simple. My default $SHELL variable is /bin/bash
因此,我似乎需要将我的 shell 重新配置为 bash,这应该很简单。我的默认 $SHELL 变量是 /bin/bash
I think it is due to the following setting under my terminal preferences:
我认为这是由于我的终端首选项下的以下设置:
run a custom command instead of my shell
/bin/tcsh/
Why should my shell preferences be set to this, what is the advantage/use of tcsh over bash?
为什么我的 shell 首选项应该设置为这个,tcsh 相对于 bash 的优势/用途是什么?
Also, how should I overcome this issue while still retaining use of any of the features which may rely upon this default terminal preference (/bin/tcsh)
另外,我应该如何克服这个问题,同时仍然保留使用可能依赖于这个默认终端首选项(/bin/tcsh)的任何功能
Here is some of my system information:
这是我的一些系统信息:
Ubuntu 14.02
$SHELL
/bin/bash
$BASH_VERSION
undefined variable
I have previously used the following command to change from DASH to BASH:
我之前使用过以下命令从 DASH 更改为 BASH:
sudo dpkg-reconfigure dash
I have also previously used the following command:
我以前也使用过以下命令:
sudo apt-get install csh
采纳答案by Joe
I suspect that you have /bin/bash already set, but to help you change it if not:
我怀疑您已经设置了 /bin/bash,但如果没有,请帮助您更改它:
The default shell for an user is set inside /etc/passwd (usually).
You could see which is set for you by doing:
用户的默认 shell 设置在 /etc/passwd 中(通常)。
您可以通过执行以下操作来查看为您设置的内容:
grep "user" /etc/passwd
Where user is your username in the system. The last value (after the last ":") is the value of shell set for you to use. You could change it in two ways, either by editing the file, or easier, by executing "chsh" (which means: "change login shell"):
其中 user 是您在系统中的用户名。最后一个值(在最后一个“:”之后)是 shell 设置的值供您使用。您可以通过两种方式更改它,或者通过编辑文件,或者通过执行“chsh”(这意味着:“更改登录外壳”)来更轻松:
$ chsh
It will ask for your password and then will ask for the shell you want to use, just write "/bin/bash".
它会询问您的密码,然后询问您要使用的外壳,只需写“/bin/bash”。
Done. To make the changes apply to all the programs, just log-out and log-in again.
完毕。要将更改应用于所有程序,只需注销并再次登录。
A second level of configuration belongs to the window that contain the console. I suspect that you are using gnome-terminal (the usual for Ubuntu). If not, then it may be konsole (for a KDE desktop). In any one of those, check that the configuration is not set to call "tcsh". Say which console/terminal you are using to give tips if you need them.
第二级配置属于包含控制台的窗口。我怀疑您使用的是 gnome-terminal(Ubuntu 常用的)。如果不是,那么它可能是 konsole(对于 KDE 桌面)。在其中任何一个中,检查配置是否未设置为调用“tcsh”。如果需要,请说出您正在使用哪个控制台/终端来提供提示。