我在远程服务器上使用版本7.9。
在执行了源~/.bashrc命令之后,我进入了某种我不太了解的模式。现在我拥有的不是bash $或bash #,而是bash:~ >,通过改变目录,它继续用bash:/somedirectory >进行更改。
请有人解释一下发生了什么事,以及如何回到正常状态。
# Generic $dotdir/bashshrc
# Engineering Services (ES)
#
##
# Things the user might wish to set.
export USER_PATH="~/bin" # Extra paths.
export EDITOR=vi # Preferred editor.
export PRINTER=lp # Preferred printer.
export NNTPSERVER=usenet.cisco.com # Preferred news server.
##
# Should the full environment be set up even for non-interactive shells?
# Probably not but here is a variable to control it.
export FULLENV=false # 'true' or 'false'
##
# Should all paths (even NFS, which might hang) be set up at login?
# The alias "fullpath" is available to setup your full path. It can
# also be used to change your path by changing USER_PATH above.
export FULLPATH=true # 'true' or 'false'
###########################################################################
# Everything above this line helps configure the environment.
# This line should not be removed.
dotdir=~/.files; [ -f $dotdir/sys_bashrc ] && . $dotdir/sys_bashrc
[ $FULLENV != "true" ] && [ -z "$PS1" ] && return
###########################################################################
# Everything below this line is run for interactive shells.
# If you wish the full environment even in non-interactive
# shells set FULLENV above to 'true'.
umask 022 # no write by group or other
export autologout=0 # disable autologout
export FIGNORE=".o" # don't complete .o files
# export HISTFILE=~/.bash_history # history file - this setting is now externally enforced by Secops, please don't modify.
# export HISTFILESIZE=500 # history file size - this setting is now externally enforced by Secops, please don't modify.
# export HISTSIZE=128 # save last 128 commands - this setting is now externally enforced by Secops, please don't modify.
export ignoreeof=10 # disable ^D for logout (up to 10)
set -C # disable redirect overwrite
set -b # enable immediate job notify
export PS1="\h:\w > " # shell prompt format
##
# Source other rc files after this line.
[ -f ~/.bashrc_LOB ] && . ~/.bashrc_LOB
[ -f ~/.bashrc_BU ] && . ~/.bashrc_BU
[ -f ~/.bashrc_USER ] && . ~/.bashrc_USER我打开文件来编辑路径。但除了检查写权限的额外空间外,没有做任何更改。
发布于 2021-10-05 10:10:47
尽管>是Bash的默认辅助提示符(由$PS2变量确定),但您的情况更像是意外地更改了主提示符($PS1)。
正如Paul_Pedant在注释中提到的,当您试图执行具有不平衡引号或括号的命令或未终止语句(if ... then ... fi、case ... esac、do ... done)时,将出现辅助提示符。
但是,由于您可以更改目录,所以~/.bashrc现在更有可能更改主提示符,使其看起来类似于辅助提示符:如果您确实位于辅助提示符处,那么您键入的任何命令都将用于扩展任何最初触发它的未完成的引号/括号/语句块,并且只有在完成未完成的块之后才实际执行该命令。这意味着如果您处于真正的辅助提示符中,您将无法更改目录。
最简单的解决方法是将主提示符更改为您更熟悉的值。例如:
export PS1='bash \$ '\$在主提示符中具有特殊意义:如果您是根用户,则扩展到#,如果您是常规用户,则扩展到$。
此更改是由您的~/.bashrc中的这一行引起的:
export PS1="\h:\w > " # shell prompt format您可以注释掉它,或者如果您发现hostname:current directory在提示符中的显示很有用,可以将该行更改为:
export PS1="\h:\w \$ " # shell prompt format将$ / #字符显示在提示符中,就像以前一样,同时将主机名和当前工作目录显示在提示符中。
https://unix.stackexchange.com/questions/671904
复制相似问题