Y
Hacker News
new
|
ask
|
show
|
jobs
by
charliesome
2127 days ago
Re sponge: the shell will open the output file for writing before invoking the command so in the example joey provides, /etc/passwd will be an empty file by the time sed opens it.
2 comments
samatman
2127 days ago
heh, yeah that's a mistake everyone makes once, and hopefully not more than once.
link
prakashdanish
2127 days ago
That makes sense but in the example provided, why can't we use sed with the in-line flag?
link
gpanders
2127 days ago
Because the -i flag works differently on GNU sed vs non-GNU sed and there is no way to use it portably.
link