Created
June 13, 2020 04:22
-
-
Save RA80533/e06a34ad2063a1b4607aa28c8c8c0ca1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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