mvn in bash script if statement

前端 未结 3 781
悲哀的现实
悲哀的现实 2021-02-15 17:39

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:34

    No parentheses needed for checking the exit status:

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

提交回复
热议问题