Linux 退出 Bash 模式?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10523431/
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
Exit Bash Mode?
提问by Kevin
I apologize for asking such a dumb question but my linux server is stuck in "bash" mode. When I log on through the terminal my command line looks like this:
我很抱歉问这样一个愚蠢的问题,但我的 linux 服务器卡在“bash”模式下。当我通过终端登录时,我的命令行如下所示:
-bash-3.2$
I cannot execute other commands because of this. If I type "exit" it closes the terminal window. How can I exit this bash mode so I can enter commands?!
因此,我无法执行其他命令。如果我输入“exit”,它会关闭终端窗口。如何退出此 bash 模式以便我可以输入命令?!
采纳答案by D Mac
Bash is a command line interpreter. It is one way to run commands on a linux system.
Bash 是一个命令行解释器。这是在 linux 系统上运行命令的一种方式。
Are you saying that it isn't allowing you to run the commands you enter? What error or response is it giving when you run a command using bash?
你是说它不允许你运行你输入的命令?当您使用 bash 运行命令时,它给出了什么错误或响应?
回答by D Mac
Try running the command reset
it's possible you've screwed up the session.
尝试运行命令reset
,您可能搞砸了会话。
Try running tput setb 6
which changes the bgcolor to dark red. If it works then your settings are screwed up:
尝试运行tput setb 6
将 bgcolor 更改为深红色。如果它有效,那么你的设置就搞砸了:
most likely if you have not been rooting around your system configs without proper knowledge of things: rm ~/.bashrc
最有可能的是,如果您没有在没有适当了解的情况下深入了解系统配置: rm ~/.bashrc
CTRL+ALT+F2
will pull you out of the X-Windows system and slam you into console. If things don't work properly there... you've screwed things up big time. Consult a NIX user forum for help with this topic as it isn't really a programming question.
CTRL+ALT+F2
会将您从 X-Windows 系统中拉出来,然后将您猛撞到控制台。如果那里的事情不能正常工作......你已经把事情搞砸了。请咨询 NIX 用户论坛以获取有关此主题的帮助,因为它实际上并不是一个编程问题。
http://www.unix.stackexchange.com/
http://www.unix.stackexchange.com/
Oh, and tput setb 0
will restore your default background color.
哦,tput setb 0
将恢复您的默认背景颜色。
回答by kampu
If this is not the shell you want, you can always type in eg. zsh
, tcsh
or whatever inside this bash session to get into your shell of choice.
如果这不是您想要的外壳,您可以随时输入例如。zsh
,tcsh
或此 bash 会话中的任何内容以进入您选择的 shell。
On a more permanent basis, your shell of choice is associated with your user-account. Examining /etc/passwd
, you will find that the final item on each line defines which shell that user uses. Yours is likely to be set to /bin/sh
or /bin/bash
.
在更持久的基础上,您选择的外壳与您的用户帐户相关联。检查/etc/passwd
,您会发现每行的最后一项定义了用户使用的 shell。您的很可能设置为/bin/sh
或/bin/bash
。
You are likely to have a GUI configuration tool, eg 'Users and Groups' on Ubuntu, where you can set your default shell.
您可能有一个 GUI 配置工具,例如 Ubuntu 上的“用户和组”,您可以在其中设置默认 shell。
Any changes to those settings take effect upon your next login.
对这些设置的任何更改都会在您下次登录时生效。
回答by PolarLIon
You should check two files in your own path : .bash_profile
and .bashrc
您应该检查自己路径中的两个文件:.bash_profile
和.bashrc
Make sure that they are in correct format.
确保它们的格式正确。