Created
July 24, 2017 23:44
-
-
Save jnovack/40222c542999a1e3b98956527ba43108 to your computer and use it in GitHub Desktop.
append_once()
This file contains 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
#!/bin/bash | |
function append_once() { | |
while read data; do | |
grep -q "$data" $1 || echo "$data" >> $1 | |
done | |
} | |
append_once ~/.bashrc <<EOF | |
echo 'This line is only written once.' | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment