I am trying to write the code for this psudo code; function askYN{ echo "continue?" read the response into $response }
#set some variables dothisalways="true" dothisoptional="false" if [ $dothisalways ] || [ askYN "Do the compulsory thing?" ] then echo "This is always done because dothisalways is set to true" fi if [ $dothisoptional ] || [ askYN "Do the optional thing?" ] then echo "This is done if the variable is set to true (no prompt) OR variable set to false and user answered Y at prompt" else echo "This is done if the variable is set to false AND user answered N at prompt" fi This is what i have so far, but it complains (i think) because of the parameters passed into askYN. I think i need to somehow bracket them if [ askYN "Blah" -eq 0 ] && [ $response == "yes" ] then echo "Doing it" else echo "Not doing it." fi can anyone help me? -- View this message in context: http://www.nabble.com/problem-with-conditional-syntax-tf2628098.html#a7333742 Sent from the Gnu - Bash mailing list archive at Nabble.com. _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash