Timeline for How do I check if a file already has line with "contents" in it?
Current License: CC BY-SA 2.5
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 14, 2011 at 12:30 | vote | accept | xenoterracide | ||
| Jan 12, 2011 at 21:30 | comment | added | Gilles 'SO- stop being evil' | @Hari: ! wasn't in Bourne, but it is in POSIX. | |
| Jan 12, 2011 at 16:23 | comment | added | Hari | The '!' command isn't always available in 'sh', IIRC (yeah, I know you used bash). It might be slightly more idiomatic sh to say: grep -qF "$LINE" file.txt || echo "$LINE" >> file.txt | |
| Jan 12, 2011 at 11:39 | history | answered | Keith | CC BY-SA 2.5 |