948169dbffdd190d66a2cb502ec0807800ef4012
2 # Copyright (C) 2014 Ian Kelling
3 # This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
6 local help="Usage: appendu [-h|--help] FILE [LINE]
8 Tee unique. Append each LINE or if none, each stdin line to FILE if it does not exist in FILE.
10 [-h|--help] display this message"
12 if [[ $1 == --help ||
$1 == -h ]]; then
17 if (( ${#@} == 0 )) ; then
18 echo "teeu error: need 1 or more arguments"
23 (( ${#@} >= 2 )) && MAPFILE
="${@:2}" || mapfile
-t
24 for line
in "${MAPFILE[@]}"; do
25 grep -xFq "$line" "$1" &>/dev
/null ||
tee -a "$1" <<<"$line"