Cha*_*had 55 linux command-line
我使用的是 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!
Run Code Online (Sandbox Code Playgroud)
我认为可能与提示有关,如下(PS1):
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
Run Code Online (Sandbox Code Playgroud)
但是查看在线指南以提示转义序列并没有发现任何明显的问题。
Att*_*tie 89
看起来您已经-v设置(正在运行set -v)。
要扭转这种情况,请运行set +v.
Run Code Online (Sandbox Code Playgroud)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联机帮助页(在“ Shell 内置命令”部分下)set。
或者help set从内部运行bash以更直接地访问帮助文本。
wja*_*rea 11
至少在 Bash 4.3 上,此命令与以下效果类似set -v:
trap 'echo "$BASH_COMMAND"' DEBUG
Run Code Online (Sandbox Code Playgroud)
要检查这是否会影响您,请运行
trap -p DEBUG
Run Code Online (Sandbox Code Playgroud)
要取消设置,请运行
trap - DEBUG
Run Code Online (Sandbox Code Playgroud)