From bd0b6feb730db8e08137817d1512b2b468fbb31a Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Sat, 21 Feb 2009 00:48:49 -0600 Subject: [PATCH] All diagnostics print to stderr, to prevent tainting flag cache if a crc32 algo is not usable --- flag | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/flag b/flag index 479fd83..1a38a6b 100755 --- a/flag +++ b/flag @@ -61,7 +61,7 @@ find_crc32_bin() { then export crc32_bin="${crc32}" else - echo "Failed to locate usable crc32 algo" + echo "Failed to locate usable crc32 algo" >&2 unset crc32_bin return 1 fi @@ -113,12 +113,12 @@ hexdec() { flag() { if [ -z "${1}" ] then - echo "Usage: flag 'hexcode' [symbol] [shellmode]" - echo "Generates an ANSI color flag using the specified hex codes" - echo "Uses the optional symbol (or ' ') to draw the flag" - echo "shellmode encapsulates all nonprintable codes in \[\] to" - echo " give the shell hints on how long the string is, for proper" - echo " wrapping of command prompts." + echo "Usage: flag 'hexcode' [symbol] [shellmode]" >&2 + echo "Generates an ANSI color flag using the specified hex codes" >&2 + echo "Uses the optional symbol (or ' ') to draw the flag" >&2 + echo "shellmode encapsulates all nonprintable codes in \[\] to" >&2 + echo " give the shell hints on how long the string is, for proper" >&2 + echo " wrapping of command prompts." >&2 return fi data="${1}" @@ -139,22 +139,22 @@ flag() { } pebkac() { - echo "Usage: $(basename "${0}") [-s #] [-e]" - echo "Produces a neat little ansi colour 'flag' based off" - echo " a hash of the machine's hostname (or settable via" - echo " ~/.flag or /etc/flag) which can uniquely visually" - echo " identify a machine, at a glance. Useful for placing" - echo " into /etc/issue or your bash prompt, so that you" - echo " don't send stupid commands to the wrong machine." - echo " " - echo " -s # Specify which character should be used to" - echo " render the flag. If empty, use the hex code." - echo " -e Turn on bash encapsulation mode, to provide" - echo " hints to Bash on what is or is not printable" - echo " so it can wrap your commands appropriately" - echo " when used in your prompt" - echo " " - echo "This machine's flag is as such: ($(flag "${flag_hex}"))" + echo "Usage: $(basename "${0}") [-s #] [-e]" >&2 + echo "Produces a neat little ansi colour 'flag' based off" >&2 + echo " a hash of the machine's hostname (or settable via" >&2 + echo " ~/.flag or /etc/flag) which can uniquely visually" >&2 + echo " identify a machine, at a glance. Useful for placing" >&2 + echo " into /etc/issue or your bash prompt, so that you" >&2 + echo " don't send stupid commands to the wrong machine." >&2 + echo " " >&2 + echo " -s # Specify which character should be used to" >&2 + echo " render the flag. If empty, use the hex code." >&2 + echo " -e Turn on bash encapsulation mode, to provide" >&2 + echo " hints to Bash on what is or is not printable" >&2 + echo " so it can wrap your commands appropriately" >&2 + echo " when used in your prompt" >&2 + echo " " >&2 + echo "This machine's flag is as such: ($(flag "${flag_hex}"))" >&2 exit 1 } -- 2.42.0