运行脚本时输出不返回任何内容

时间:2018-08-24 14:01:33

标签: bash solaris

运行此脚本时,我什么也没有返回。有什么建议么?这是代码。

securityTlsVersion() {
     local file="/usr/lib/firefox/mozilla.cfg"
     local config=`more $file|grep security.tls.version.max`
     local tlsmax="lockPref(\"security.tls.version.max`
     if [ "`hostname`" == "server1" ] || [ "`hostname`" == "server2" ];then
       if [ "$config" = "" ]; then
         echo "Adding security.tls.version.max line to mozilla.cfg"
         echo "tlsmax >> $file
         echo "security.tls.version.max is now configured"
       else
         echo "security.tls.version.max is already configured"
       fi
     fi
 }

1 个答案:

答案 0 :(得分:0)

下面是shellcheck的结果。这意味着第一行包含未闭合的"。正如@JNevill所写,这是从local tlsmax开始的行:

shellcheck myscript.sh 

In myscript.sh line 7:
     if [ "`hostname`" == "server1" ] || [ "`hostname`" == "server2" ];then
        ^-- SC1009: The mentioned parser error was in this test expression.
          ^-- SC1073: Couldn't parse this double quoted string.
           ^-- SC1072: Expected end of double quoted string. Fix any mentioned problems and try again.

对您有帮助吗?