all repos — dotfiles @ 0a55cd8663268a0bdb1d9044c28733921ab87885

linux dotfiles

bin/scripts/nping

#!/usr/bin/sh


if [[ $1 = "l" ]]; then
    while [ 1 ]; do
        ping -c 1 1.1.1.1 | awk 'NR==2 {print $(NF-1) " " $NF}' | 
            cut -d '=' -f2
        if [[ $2 -ne 0 ]]; then
            sleep $2
        else
            sleep 1 #default loop sleep
        fi
    done
elif [[ $1 = "ll" ]]; then
    while [ 1 ]; do
        ping -c 1 1.1.1.1 | awk 'NR==2 {print $(NF-1) " " $NF}' | 
            cut -d '=' -f2
    done;
else
    ping -c 1 1.1.1.1 | awk 'NR==2 {print $(NF-1) " " $NF}' | cut -d '=' -f2
fi