为什么我的Linux系统会重复我输入的每个命令?

Modified on: Sat, 23 Mar 2019 00:20:02 +0800

我正在使用Ubuntu Linux系统,我输入的每个命令都显示在下一行,然后输出命令。例如:

root@dpkube165:~# ls
ls  <--- why is this here?
Desktop  Documents  Downloads 

root@dpkube165:~# date
date  <--- or this?
Mon Mar 19 11:24:59 EDT 2018

root@dpkube165:~# echo "Hello, world!"
echo "Hello, world!" <--- or this?
Hello, world!

我认为这可能与提示有关,如下所示(PS1):

\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$

但是,查看在线指南以提示转义序列并未发现任何明显的事情。

作者:,Chad

最佳答案

看起来你已经设置了-v(某些东西正在运行set -v)。

要反转此操作,请运行set +v

set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...]
set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]
       Without  options, the name and value of each shell variable are displayed in a
       format that can be reused as input for setting or resetting the currently-set
       variables. Read-only variables cannot be reset. In posix mode, only shell
       variables are  listed. The output is sorted according to the current locale.
       When options are specified, they set or unset shell attributes. Any arguments
       remaining after option processing are treated as values for the positional
       parameters and are assigned, in order, to $1, $2, ...  $n.  Options, if
       specified, have the following meanings:

[...]

-v      Print shell input lines as they are read.

请参阅bash联机帮助页(在“< em> Shell Builtin命令“部分)有关set内置命令的更多信息。

或者从help set中运行bash,以便更直接地访问帮助文本。

作者:,Attie

相关问答

添加新评论