How to do a hg update or clone in one line of bash?

前端 未结 2 1114
日久生厌
日久生厌 2021-01-21 03:12

I am looking for an option to do an hg update on a repository or to clone it if it doesn\'t exist. So the command has to fail only if something went wrong (clone or update).

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-21 03:51

    cd  && hg update || hg clone 
    

    If the cd fails because directory doesn't exist, then the hg clone is run from the correct directory level.

提交回复
热议问题