Conditionally execute commands.
Synopsis
if TEST-COMMANDS; then COMMANDS; [elif TEST-COMMANDS; then COMMANDS;]... [else COMMANDS;] fi
Description
Execute COMMANDS based on the exit status of TEST-COMMANDS. Runs in the just-bash WASM shell inside SLICC.
Examples
$ if [ -f file.txt ]; then echo "exists"; else echo "not found"; fi
Check if a file exists.
$ if grep -q "error" log.txt; then echo "Errors found"; fi
Check if a pattern exists in a file.
See Also
test, case, then, fi