Bash #14 - while / until loops (with port scan example) @itvraag
Bash #14 - while / until loops (with port scan example)  @itvraag
Uploaded April 2022 | Updated September 2026, 2 weeks ago
In this video we'll go through while and until loops in bash scripting and test this using examples like a port scan.
#bashscripting #terminal
https://itvraag.nl

Related videos:
Bash #1 - Basics: youtu.be/C-HwzPVLo1c
Bash #3 - Script files: youtu.be/ajpTOFyeDH4
Bash #4 - Variables: youtu.be/mOSnZ7zOF3g
Bash #5 - Arithmetic operators: youtu.be/DMPfEq6YAq8
Bash #10 - Combining commands: youtu.be/ixPZOoONsAs

Used scripts:
#!/bin/bash
n=0
while [ $n -lt 9 ]
do
echo This number is less than 9: $n
((n++))
done

#!/bin/bash
n=0
until [ $n -gt 9 ]
do
echo This number is NOT greater than 9: $n
((n++))
done

#!/bin/bash
n=0
i=12
while [[ $n -lt 9 && i -lt 14 ]]
do
echo This number $n is less than 9 and this number $i is less than 14
((n++))
((i++))
done

Port scan script (angled brackets are removed, due to video description limitations):
#!/bin/bash
i=0
while [ $i -lt 5000 ]
do
(echo /dev/tcp/127.0.0.1/$i) &/dev/null && printf "Open Port at:$i" || printf "."
((++i))
done

Timestamp:
0:27 while & until loops in general
0:43 while loop with example
1:01 logical conditions
1:34 until loop with example
1:47 loops with multiple conditions
2:25 while loop with port scan
2:58 endless loops
Bash #14 - while / until loops (with port scan example)Windows 7: Show Logon MessageHow To Restore Data/Files From A Defective LaptopUsing Notion, restarted my channel (after 3 years)Use Of Tablet/Smartphone On Vacation/HolidayVim #2 - navigation- and search commandsWindows 7 - Enabling Hidden Admin Account (Lost Password)Git #4 - diff, log, amend (with tips)Puppet #3 - Setting up GitHub repo for Puppet server & configure r10kWindows 10 on MacBook with VirtualBoxGalaxy S3 - S Voice/CMD For AppsRedHat #1 - Package manager DNF (Fedora, RHEL, Rocky Linux)
itvraag |

Bash #14 - while / until loops (with port scan example)

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER