Skip to content

Instantly share code, notes, and snippets.

@greymd

greymd/ping_nyan.sh

Last active Sep 28, 2018
Embed
What would you like to do?
通常のpingで「にゃーん」を表示するシェル芸
#!/bin/bash
# From: https://twitter.com/grethlen/status/906154326975905793
sudo ping -i 0 -c 1400 pong4.kooshin.net \
| grep -oP "icmp_seq=\K\d+" \
| cat - <(seq 1 1400) \
| sort -n \
| uniq -c \
| awk '{printf $1}' \
| fold -w70 \
| tr '12' 'U!'
@greymd

This comment has been minimized.

Copy link
Owner Author

@greymd greymd commented Sep 8, 2017

Ciscoのルータのようにアニメーションっぽく。

sudo ping -i 0 -c 1400 pong4.kooshin.net | grep --line-buffered -oP "icmp_seq=\K\d+" | awk '{n=$1-lst;print "!"; for(i=0;i<n-1;i++){print "U"}}{lst=$1;fflush()}' | awk '{printf $0}NR%70==0{print "";fflush()}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.