X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=appendu;h=43e2e8737aaffabf42ecc47005e395094bfe6a61;hb=0b9edb4236585a0ad6ce56af9a9bd35e21b0d75d;hp=c7455dccdbe43be08e1b5f858f8ef2db7f8f0fcc;hpb=7ca836a05e81aeac0758b10d220e4b618c854ea8;p=tee-unique diff --git a/appendu b/appendu index c7455dc..43e2e87 100755 --- a/appendu +++ b/appendu @@ -49,14 +49,14 @@ Appended lines are output to the terminal. [[ ! -w $dir ]] && writesudo=sudo else echo "appendu error: $dir does not exist" - exit 1 + return 1 fi fi if ! $dosudo; then readsudo= writesudo= fi - if [[ $@ ]]; then + if (( $# )); then for x in "$@"; do [[ -e "$file" ]] && $readsudo grep -q "^$x$" "$file" || $writesudo tee -a "$file"<<<"$x" done