最近,每当我打开终端时,bash 都会在进入提示符之前将以下文本(一些信息被删除)打印到其中:
declare -x CCACHE_DIR="/local/.ccache"
declare -x CLICOLOR="1"
declare -x CLUTTER_IM_MODULE="xim"
declare -x COMPIZ_CONFIG_PROFILE="ubuntu"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-VbKgpDXElV"
declare -x DEFAULTS_PATH="/usr/share/gconf/ubuntu.default.path"
declare -x DESKTOP_SESSION="ubuntu"
declare -x DISPLAY=":0"
declare -x EDITOR="vim"
declare -x ENV="<home>/.profile"
declare -x GDMSESSION="ubuntu"
declare -x GDM_LANG="en"
declare -x GNOME_DESKTOP_SESSION_ID="this-is-deprecated"
declare -x GNOME_KEYRING_CONTROL=""
declare -x GNOME_KEYRING_PID=""
declare -x GPG_AGENT_INFO="<home>/.gnupg/S.gpg-agent:0:1"
declare -x GTK2_MODULES="overlay-scrollbar"
declare -x GTK_IM_MODULE="ibus"
declare -x GTK_MODULES="gail:atk-bridge:unity-gtk-module"
declare -x HISTCONTROL="erasedups:ignoreboth"
declare -x HOME="<home>"
declare -x IM_CONFIG_PHASE="1"
declare -x INSTANCE="Unity"
declare -x JOB="gnome-session"
declare -x LANG="en_US.UTF-8"
declare -x LANGUAGE="en"
declare -x LC_ADDRESS="de_DE.UTF-8"
declare -x LC_ALL="en_US.UTF-8"
declare -x LC_IDENTIFICATION="de_DE.UTF-8"
declare -x LC_MEASUREMENT="de_DE.UTF-8"
declare -x LC_MONETARY="de_DE.UTF-8"
declare -x LC_NAME="de_DE.UTF-8"
declare -x LC_NUMERIC="de_DE.UTF-8"
declare -x LC_PAPER="de_DE.UTF-8"
declare -x LC_TELEPHONE="de_DE.UTF-8"
declare -x LC_TIME="de_DE.UTF-8"
declare -x LOGNAME="<myname>"
declare -x LSCOLORS="gxBxhxDxfxhxhxhxhxcxcx"
declare -x MANDATORY_PATH="/usr/share/gconf/ubuntu.mandatory.path"
declare -x OLDPWD
declare -x PAPERSIZE="a4"
declare -x PATH="/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:"
declare -x PLUTO_WORKSPACE="/local/pluto_workspace"
declare -x PS1="\${debian_chroot:+(\$debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\[\$(git_color)\\] \$(git_branch)\\[\\033[0;37m\\]\$\\[\\033[0m\\] "
declare -x PWD="/home/student/r/rdiederichse"
declare -x QT4_IM_MODULE="xim"
declare -x QT_ACCESSIBILITY="1"
declare -x QT_IM_MODULE="ibus"
declare -x QT_LINUX_ACCESSIBILITY_ALWAYS_ON="1"
declare -x QT_QPA_PLATFORMTHEME="appmenu-qt5"
declare -x SESSIONTYPE="gnome-session"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="<home>/.ssh/ssh_auth_sock"
declare -x TERM="xterm-256color"
declare -x UPSTART_EVENTS="started starting"
declare -x UPSTART_INSTANCE=""
declare -x UPSTART_JOB="unity-settings-daemon"
declare -x UPSTART_SESSION="unix:abstract=/com/ubuntu/upstart-session/57109/2823"
declare -x USER="rdiederichse"
declare -x VTE_VERSION="4205"
declare -x WINDOWID="65017897"
declare -x XAUTHORITY="<home>/.Xauthority"
declare -x XDG_CONFIG_DIRS="/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg"
declare -x XDG_CURRENT_DESKTOP="Unity"
declare -x XDG_DATA_DIRS="/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop"
declare -x XDG_GREETER_DATA_DIR="/var/lib/lightdm-data/<myname>"
declare -x XDG_RUNTIME_DIR="/run/user/57109"
declare -x XDG_SEAT="seat0"
declare -x XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0"
declare -x XDG_SESSION_DESKTOP="ubuntu"
declare -x XDG_SESSION_ID="c2"
declare -x XDG_SESSION_PATH="/org/freedesktop/DisplayManager/Session0"
declare -x XDG_SESSION_TYPE="x11"
declare -x XDG_VTNR="7"
declare -x XMODIFIERS="@im=ibus"
我不记得在我的配置文件中更改过任何相关的终端设置或某些内容。我该如何摆脱它以及它是什么?
我使用的是 Ubuntu 16.04 LTS 和默认终端模拟器。
答案1
这就是declare -x
在不带其他参数调用时打印出来的内容。(如果您好奇它是什么,请help declare
在 bash 提示符下尝试。)
某处某物/某人编辑了一个 rc 文件,然后您得到了这个命令。我猜是有人犯了一个错误,把declare -x $SOMETHING
原本应该的改成了declare -x SOMETHING
。如果$SOMETHING
尚未定义,则第一个形式declare -x
在变量扩展后将变为纯文本。
如果您检查您的.bashrc
等并且没有发现它,请尝试将其放在set -x
您的顶部.bashrc
,以便您可以看到执行时的初始化命令。