Skip to content

Instantly share code, notes, and snippets.

@someara
Created July 19, 2012 17:08
Show Gist options
  • Save someara/3145376 to your computer and use it in GitHub Desktop.
Save someara/3145376 to your computer and use it in GitHub Desktop.
append_if_no_such_line
function append_if_no_such_line() {
local line="$1";
local file="$2";
if ! grep "^`printf '%q' "$line"`$" $file 2>&1>/dev/null ; then echo "$line" >> $file ; fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment