3 ms·
How is sponge different from just normal file redirection?
by umvi 6y ago
How is sponge different from just normal file redirection?
- fred256 6y agoSee the first example on the web page: % sed "s/root/toor/" /etc/passwd | grep -v joey | sponge /etc/passwd If you tried this as: % sed "s/root/toor/" /etc/passwd | grep -v joey > /etc/passwd The shell would overwrite /etc/passwd with an empty file before sed has a chance to read from it.