What word will complete an if statement in bash such as the following:

What word will complete an if statement in bash such as the following:

if [-x "$file"]; then
echo $file
______

(Please provide the missing word only)

What word will complete an if statement in bash such as the following:

if [-x "$file"]; then
echo $file
______

(Please provide the missing word only)

Answer: fi

Explanation:
From the man pages:
if list; then list; [ elif list; then list; ] … [ else list; ] fi

The if list is executed. If its exit status is zero, the then list is executed. Otherwise, each elif list is executed in turn, and if its exit status is zero, the corresponding then list is executed and the command completes. Otherwise, the else list is executed, if present. The exit status is the exit status of the last command executed, or zero if no condition tested true.



Leave a Reply 0

Your email address will not be published. Required fields are marked *