开发者

bash script parameters problem

开发者 https://www.devze.com 2023-01-24 02:38 出处:网络
i can\'t figure out, where is the problem if [ $# -eq 1 ]; then if [ \"$1\"==\"-h\" ]; then help else echo \"bad parameter, if you put only one 开发者_C百科parameter, you can choose only -h\"

i can't figure out, where is the problem

if [ $# -eq 1 ]; then
    if [ "$1"=="-h" ]; then
            help
    else
            echo "bad parameter, if you put only one 开发者_C百科parameter, you can choose only -h"
    fi

no matter what i give it as first parameter, script never gets to the else part and every time it is displaying help


Correct syntax:

if [ "$1" = "-h" ]
0

精彩评论

暂无评论...
验证码 换一张
取 消