if-else statements allow us to make decisions in our Bash scripts. They allow us to decide whether or not to run a piece of code based upon conditions that we may set.
num=5
if [ $num -lt 0 ]; then
echo "number is negative";
elif [ $num -lt 10 ]; then
echo "number is less than 10";
else
echo "number is equal or greater than 10";
fi
| Problem | Score | Companies | Time | Status |
|---|---|---|---|---|
| Valid phone number | 150 |
|
22:40 | |
| Lines in a given range | 200 |
|
27:20 | |
| Remove Punctuations | 250 |
|
13:07 | |
| Transform CSV | 300 |
|
19:00 |