Linux Shell Script: 1 se 20 tak Numbers | 4, 8, 12, 16, 20 Skip |30 September 30 2026
Daily classes videos
0:00 / 0:00
Linux Shell Script: 1 se 20 tak Numbers | 4, 8, 12, 16, 20 Skip |30 September 30 2026
35 просмотров · 4 дня назад
Daily classes videos
8 подписчиков
35 просмотров · 4 дня назад
Assalam-o-Alaikum!
Is video mein hum Shell Scripting / Bash ke through 1 se 20 tak numbers print karte hain, lekin un numbers ko skip karte hain jo 4 se divide ho jate hain. Yani output mein 4, 8, 12, 16, 20 nahi aayenge.
Final Output:
1 2 3 5 6 7 9 10 11 13 14 15 17 18 19
Video Mein Kya Seekhenge:
· Shell Script mein for loop chalana
· 1 se 20 tak iteration
· if condition lagana
· Modulo operator % se check karna
· 4 se divisible numbers skip karna
· Final output print karna
Shell Script Code:
```bash
#!/bin/bash
for i in {1..20}
do
if (( i % 4 != 0 ))
then
echo $i
fi
done
```
Alternative Code (sh compatible):
```bash
for i in $(seq 1 20)
do
if [ $((i % 4)) -ne 0 ]; then
echo $i
fi
done