我在为 Coursera Scala 课程设置 Sbt 时搞砸了我的终端。我无法再调用 gedit(或其他任何东西)。我收到以下错误:
Command 'gedit' is available in '/usr/bin/gedit'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
此外,每个新的终端实例都会在写入任何命令之前写入这些消息:
-bash: :/home/antonio/jdk7/jdk1.7.0_07/bin: No such file or directory
-bash: export: `/home/antonio/Desktop/Scala/install/sbt/bin:/home/antonio/jdk7/jdk1.7.0_07/bin': not a valid identifier
我最近手动安装了 jdk 7,显然它可以工作:
java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
在设置 Sbt 时,我犯了一个错误,gedit ~/.bashrc
在终端上编辑 bashrc 时应该写入 而不是gedit .bashrc
,我在打开的 bashrc 文件末尾写了以下几行:
export PATH=/PATH/TO/YOUR/jdk1.7.0-VERSION/bin:$PATH
export PATH=/home/antonio/jdk7/jdk1.7.0_07/bin:$PATH
这里有什么问题?
我如何访问我的 bashrc 文件并再次修改它?
答案1
复制.bashrc从你的/etc/skel回到家然后重新启动
cp /etc/skel/.bashrc /home/your-user
答案2
创建一个新用户并将其主目录中的 .bashrc 复制到你的主目录中
cp /home/newuser/.bashrc /home/myuser/