Skip to content

Instantly share code, notes, and snippets.

@mnathani
Created August 27, 2017 05:52
Show Gist options
  • Save mnathani/557f6aac04ae7f7106b8d5297ea7b150 to your computer and use it in GitHub Desktop.
Save mnathani/557f6aac04ae7f7106b8d5297ea7b150 to your computer and use it in GitHub Desktop.
Parallel not working
#!/usr/bin/env bash
res1=$(date +%s.%N)
OUTPUT="$(dig "$1")" &
WHOIS="$(whois "$1")" &
wait
echo "<pre>"
echo "$OUTPUT"
echo "</pre>"
echo "<h2>Whois Output for" $1 "</h2>"
echo "<pre>"
echo "$WHOIS"
echo "</pre>"
res2=$(date +%s.%N)
dt=$(echo "$res2 - $res1" | bc)
dd=$(echo "$dt/86400" | bc)
dt2=$(echo "$dt-86400*$dd" | bc)
dh=$(echo "$dt2/3600" | bc)
dt3=$(echo "$dt2-3600*$dh" | bc)
dm=$(echo "$dt3/60" | bc)
ds=$(echo "$dt3-60*$dm" | bc)
printf "Total runtime: %d:%02d:%02d:%02.4f\n" $dd $dh $dm $ds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment