0 command-line bash .profile etc 16.04
我对 Ubuntu 相当陌生,并且做了一些比我应该做的更多的事情。我正在阅读有关下载 Oracle 8 JDK 的指南,它说要更改 /etc/profile 文件的最后几行。执行此操作后,它弹出一个错误,现在我不知道如何将其更改回来。
bash:/etc/profile:第 25 行:意外标记
fi' bash: /etc/profile: line 25:fi'附近的语法错误
这就是弹出的错误。这是 /etc/profile 文件的样子:
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
fi
JAVA_HOME=/usr/lib/jvm/java-8-oracle
PATH=$PATH:$HOME/BIN:$JAVA_HOME/bin
export JAVA_HOME
export PATH
Run Code Online (Sandbox Code Playgroud)
我不知道如何阅读这篇文章或如何修复它,我一开始就试图编辑它是愚蠢的,不知道我在做什么,但任何关于如何修复它的建议将不胜感激。谢谢!
这里的部分:
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
fi
Run Code Online (Sandbox Code Playgroud)
必须看起来像这样:
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
fi
Run Code Online (Sandbox Code Playgroud)