Back
Close

Computing with Data

elgeish
33.3K views
Previous: Bash - Loops Next: Bash - Aliases

Bash - Conditional Logic

# Example: if-else statements
a=4 ; b=3 ; if [ $a -eq $b ] ; then echo 1 ; else echo 0 ; fi
# Example: logical operators
a=4 ; b=3 ; [ $a -eq $b ] && echo 1 || echo 0
# Example: brace expansion
echo {b,c}; echo a{b,c}d; echo a{a..m}d
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants