Tee unique. Append each LINE or if none, each stdin line to FILE if it does not exist in FILE.
[-h|--help] display this message"
-
if [[ $1 == --help || $1 == -h ]]; then
echo "$help"
echo "$help"
return 1
fi
- local file="$1"; shift
-
local MAPFILE
- mapfile -t
- for line in "${@:-$MAPFILE[@]}"; do
+ (( ${#@} >= 2 )) && MAPFILE="${@:2}" || mapfile -t
+ for line in "${$MAPFILE[@]}"; do
grep -xFq "$line" "$1" &>/dev/null || tee -a "$1" <<<"$line"
done
return 0
Tee unique. Append each LINE or if none, each stdin line to FILE if it does not exist in FILE.
[-h|--help] display this message"
-
if [[ $1 == --help || $1 == -h ]]; then
echo "$help"
echo "$help"
return 1
fi
- local file="$1"; shift
-
local MAPFILE
- mapfile -t
- for line in "${@:-$MAPFILE[@]}"; do
+ (( ${#@} >= 2 )) && MAPFILE="${@:2}" || mapfile -t
+ for line in "${$MAPFILE[@]}"; do
grep -xFq "$line" "$1" &>/dev/null || tee -a "$1" <<<"$line"
done
return 0