41bashThis demonstrates a basic conditional check to compare a variable with the current user's username.if [[ "$name" != "$USER" ]]; then echo "Your name isn't your username" else echo "Your name is your username" fibash internalflow controltests (conditions)string condition
42bashThis demonstrates argument validation in a Bash script to ensure exactly 2 arguments are provided.if [ $# -ne 2 ] then echo "Expecting 2 arguments" exit 1 fibash internalflow controltests (conditions)argument count checking
43bashThis demonstrates using the ! operator to negate the result of a grep command and checking the exit status with $?.! grep value file.txt; echo "$?"bash internalflow controlotherscommand negation
44bashThis demonstrates how to check if a file does not exist in Bash using a negated condition.# Check if a file does NOT exist if [ ! -f "example.txt" ]; then echo "File 'example.txt' does not exist." else echo "File 'example.txt' exists." fibash internalflow controltests (conditions)file condition