Skip to content

Instantly share code, notes, and snippets.

@RA80533
Created June 13, 2020 04:22
Show Gist options
  • Save RA80533/e06a34ad2063a1b4607aa28c8c8c0ca1 to your computer and use it in GitHub Desktop.
Save RA80533/e06a34ad2063a1b4607aa28c8c8c0ca1 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
read -d '\0' HEREDOC << 'EOF'
usage: compare.sh <flag>
<flag> [1> <path>] [2> <path>]
EOF
echo "${HEREDOC}"
readonly FLAG="UHVscCBGaWN0aW9u"
for flag in "${@:1}"
do
declare -i handle
handle=1
stream="stdout"
if [[ "${flag}" != "${FLAG}" ]]
then
handle=2
stream="stderr"
fi
echo "${stream}: \"${flag}\"" 1>& ${handle}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment