Skip to main content
edited tags; edited title
Link
codeforester
  • 41.8k
  • 19
  • 115
  • 149

In bash, how to How do I set a$? or the return code in Bash?

Source Link
JohnnyFromBF
  • 10.1k
  • 11
  • 46
  • 63

In bash, how to set a return code?

I want to set a return value once so it goes into the while loop:

#!/bin/bash
while [ $? -eq 1 ]
do
#do something until it returns 0    
done

In order to get this working I need to set $? = 1 at the beginning, but that doesn't work.