Bash: if statement
A short, tested Bash example for if statement. Copy it and adjust the names and paths for your project.
Bash
if [ -f "$file" ]; then echo "file exists"; fi
if [ -d "$dir" ]; then echo "directory"; fi
if [ "$a" = "$b" ]; then echo "equal"; fi
if [ "$n" -gt 5 ]; then echo "bigger"; fi
if [[ $name == a* ]]; then echo "starts with a"; fiFind it in Zest
Search for “bash if statement” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.