Created
July 19, 2012 17:08
-
-
Save someara/3145376 to your computer and use it in GitHub Desktop.
append_if_no_such_line
This file contains hidden or 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
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