Basic Shell Commands

Go to Problems

Loops in Unix with example

Loops allow us to take a series of commands and keep re-running them until a particular situation is reached. They are useful for automating repetitive tasks.

For loop:
for i in {5..10};
do
echo $i;
done
While loop:
i=1
while [ $i -le 20 ]
do
echo "$i"
i=$(($i+1))
done

Serious about Learning Scripting ?

Learn this and a lot more with Scaler Academy's industry vetted curriculum.
Shell scripting
Problem Score Companies Time Status
Valid phone number 150
22:24
Lines in a given range 200
27:49
Remove Punctuations 250
12:58
Transform CSV 300
19:07