How can you run a command in bash over until success

前端 未结 6 808
走了就别回头了
走了就别回头了 2020-11-28 19:10

I have a script and want to ask the user for some information, the script cannot continue until the user fills in this information. The following is my attempt at putting a

6条回答
  •  无人及你
    2020-11-28 19:26

    To elaborate on @Marc B's answer,

    $ passwd
    $ while [ $? -ne 0 ]; do !!; done
    

    Is nice way of doing the same thing that's not command specific.

提交回复
热议问题