Function return values within BASH if statements
问题 I have looked at various ways on here handle function return values within BASH if-then statements, but none seem to work. Here is what I've got function is_cloned() { if [ -d $DIR_NAME ] then return $SUCCESS fi return $FAILURE } It will work if I call it on its own and check the return value like: is_cloned retval=$? if [ $retval -eq $FAILURE ] then ... fi How can I use the function call within the if statement? Or is there no way at all to take advantage of the return values? 回答1: if