Skip to content

Commit

Permalink
pingo: print useful data to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
rdavid committed May 1, 2023
1 parent 30f5d69 commit a8c3e0b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app/pingo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
# vi:et lbr noet sw=2 ts=2 tw=79 wrap
# Copyright 2022-2023 David Rabkin
# Adds timestamps to the ping command output.
# shellcheck disable=SC1091 # Disables not following the file.
# shellcheck disable=SC3043 # Uses local variables.
# shellcheck disable=SC1091,SC2034 # File not following, appears unused.
readonly \
BASE_APP_VERSION=0.9.20230502 \
BASE_MIN_VERSION=0.9.20230501
. base.sh
[ $# -eq 1 ] || die Usage: pingo [network resource].
{ ping "$1" 2>&1 1>&3 3>&- | tologe; } 3>&1 1>&2 | tolog

# Redirects input to tsout line by line.
totsout() {
local lne
while IFS= read -r lne; do tsout "$lne"; done
}

# Starting point.
[ $# -ge 1 ] || die Usage: pingo [network resource].
{ ping "$1" 2>&1 1>&3 3>&- | tologe; } 3>&1 1>&2 | totsout

0 comments on commit a8c3e0b

Please sign in to comment.