Bash script yourself the dopest lil please wait/prog meter — yes bash
1 min readAug 30, 2023
Keeping it short and sweet, if you dont know and trust my posts by now, move on. Prereq’s will be: apt-get install parallel
People who know what up read on
#!/bin/bash
# Function to display the spinning [X] character
spinner() {
local delay=0.05
local spinstr='⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'
local i=2
while true; do
printf "\r[ ${spinstr:$i:1} ]"
sleep $delay
((i = (i + 1) % ${#spinstr}))
done }
# Function to check if the response contains "not found" and display [X]
chkrsp() {
if grep -q "not found" <<< "$1"; then
tput el # Clear the spinner line
printf "\r[\033[31mX\033[0m] "
fi
}
THREEOC="104.153.134."
export -f chkrsp
spinner &
spinner_pid=$!
seq 0 255 | parallel -j 5 "host $THREEOC{} | chkrsp"
kill $spinner_pid
wait $spinner_pid 2>/dev/null # Suppress the "Terminated" message
echo
Call it spin.sh; chmod +x ./spin.sh; ./spin.sh
- dont be in tm/screen or it doesnt work as good*
- Youll see
- [ ⠋ ]
- [ ⠋ ]
- ^ Diff phases of the prog. meter, you can modify it to add ansi or whqtever.
- just thought id share it
- peace
- dj substance