Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
charliesome
· 6y ago · 0 comments
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.
Comments
[–]
samatman
6y ago
heh, yeah that's a mistake everyone makes once, and hopefully not more than once.
[–]
prakashdanish
6y ago
That makes sense but in the example provided, why can't we use sed with the in-line flag?
[–]
gpanders
6y ago
Because the -i flag works differently on GNU sed vs non-GNU sed and there is no way to use it portably.