mvn in bash script if statement

前端 未结 3 1762
北荒
北荒 2021-02-15 18:06

I want to run the command mvn clean in a bash script. But I want to put it in an if statement. If the clean does not run properly I would like to exit out of the bash script wit

3条回答
  •  名媛妹妹
    2021-02-15 18:21

    No parentheses needed for checking the exit status:

    if mvn clean ; then
       echo ok
    else
       echo Something went wrong.
       exit 1
    fi
    

提交回复
热议问题