这个shell脚本有什么错误

use*_*521 0 unix linux shell

我写了以下代码..

installFunction(){

    perl Makefile.PL
    flag1 = $?

    make    
    flag2 = $?

    make install
    flag3 = $?

    make test
    flag4 = $?

    cd ..


    return $flag1 || $flag2 || $flag3 || $flag4
}
if(installFunction != 0)
    then
        echo "installation failure"
        exit
fi  
Run Code Online (Sandbox Code Playgroud)

但是当我运行代码时,我得到以下错误

./install:53:flag1:找不到

./install:53:flag2:找不到

./install:53:flag3:找不到

./install:53:flag4:找不到

谁能说出问题是什么?

提前致谢!!

bkc*_*rad 6

尝试

flag1=$?
Run Code Online (Sandbox Code Playgroud)

注意缺乏空间.

http://tldp.org/LDP/abs/html/varassignment.html


正如kev所说,你的if陈述是无效的.

installFunction
if [ $? -ne 0 ]
then
        echo "installation failure"
        exit
fi
Run Code Online (Sandbox Code Playgroud)

应该管用.强制性链接:http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html