Re: [PATCH] Warnings before rebasing -i published history
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jun 8, 2012, 08:52 UTC
- Message-ID
- <vpqfwa618zv.fsf@bauges.imag.fr>
- In-Reply-To
- <20120608093257.Horde.eeddeHwdC4BP0aqpIrqTaVA@webmail.minatec.grenoble-inp.fr>
konglu@minatec.inpg.fr writes:
> The fact is that the input of sed is "$1" itself. An redirecting the output > of sed to the same input doesn't seem to work.
No, reading and writing to the same file usually doesn't work (unless you have a very good reason to do it). But using printf seems weird. It just forces the shell to hold the whole output of sed in memory to be able to pass it to printf.
Isn't a more conventional way to do that
sed -e '...' "$1" >"$1".new mv "$1".new "$1"
?
-- Matthieu Moy http://www-verimag.imag.fr/~moy/