Bug背景
未修改任何配置的情況下,重啓hadoop
biglucky@localhost>sh start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
start-all.sh: 112: /opt/hadoop-2.7.1/sbin/../libexec/hadoop-config.sh: Syntax error: word unexpected (expecting ")")
提示了“Syntax error: word unexpected (expecting “)”)”這樣的異常,而這段期間我沒有修改過任何配置。於是各種找資料使用
sudo sh start-all.sh
等這樣的命令也會出錯。
解決方式
1.bash執行
bash start-all.sh
2. 直接運行
>start-all.sh
結果
後來發現,直接運行start-all.sh 腳本不會出錯:
biglucky@localhost>start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop-2.7.1/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/kael/CDH/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Starting namenodes on [ubuntu]
ubuntu: starting namenode, logging to /opt/hadoop-2.7.1/logs/hadoop-kael-namenode-ubuntu.out
ubuntu: SLF4J: Class path contains multiple SLF4J bindings.
總結
1. bash 和 sh 不同:一般的,sh是bash的“子集” (不是子集的部分,具體區別見下的“Things sh has that bash does not”)
(1)sh一般設置成bash的軟鏈接;
在一般的linux操作系統之中,使用sh等於打開了bash的posix的標準模式 ,等於執行
bash --posix
(2)sh與bash的區別相當於 bash的posix標準模式與bash的區別,其中就有let截取字符串等。
“sh”並不是一個程序,而是一種標準(POSIX),這種標準,在一定程度上保證了腳本的跨系統性(跨UNIX系統)