X-Git-Url: http://git.grml.org/?p=grml-scripts.git;a=blobdiff_plain;f=usr_bin%2Frandom-hostname;h=7386abb04a06da090ee932707c598492838f8745;hp=019c1e1c2ef5afb50b3b3b0d2cf62fc6cff3a476;hb=HEAD;hpb=e720deae78f1eda5e6f62629606c194f16796762 diff --git a/usr_bin/random-hostname b/usr_bin/random-hostname index 019c1e1..7386abb 100755 --- a/usr_bin/random-hostname +++ b/usr_bin/random-hostname @@ -4,15 +4,14 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Sam Sep 30 11:42:30 CEST 2006 [mika] ################################################################################ -num=$(wc -l $0) -num=${num%% $0} -num=$(( $num - 16 )) -randline=$(($(date +%Y%M%S) * $$ % $num)) -hostname=$(tail -n $randline "$0" | head -1 | grep -v "'" | grep -v '^#' | grep -v '^$') +hostname_start=$(grep -n "^# EOF" "$0") +hostname_start=${hostname_start%%:#*} +hostname_start=$(( hostname_start + 3 )) +hostname=$(tail -n +$hostname_start "$0" | grep -v "'" | grep -v '^#' | grep -v '^$' | sort -R | tail -1) [ -n "$hostname" ] && echo "$hostname" || echo "grml" -# EOF - line 15; now the hostnames: +# EOF - now the hostnames: +# shellcheck disable=SC2034 hostnames=' 23 42 @@ -176,6 +175,7 @@ homersexual hoth hoyvin-mayvin hypohemia +idspispopd ilum introubulate jabba @@ -192,6 +192,7 @@ kashyyyk kidnappophilie kilbeggan killbot-factory +kitchensink knifey-spooney knowitallism knowledgeum @@ -336,6 +337,7 @@ soulianis spaghettimonster spambox speedholes-or-speed-holes +spispopd spokesrebel ssh stabby