If Statement in Shell
Level 379 keystrokes
if statement checks conditions and executes different code branches.
Shell code
# [ -f "config.json" ] is true if config.json exists and is a regular file1if [ -f "config.json" ]; then # Runs when the file exists; prints: Config found2 echo "Config found"3else # Runs when the file is missing4 echo "Config missing"# fi (if spelled backwards) ends the if block5fiOutput
Config found
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Shell code and how often they appear.
"× 6-× 1;× 1.× 1[× 1]× 1