zsh-users
 help / color / mirror / code / Atom feed
* editing file in-place with '<>'
@ 2014-06-23  8:06 Han Pingtian
  2014-06-23  8:57 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Han Pingtian @ 2014-06-23  8:06 UTC (permalink / raw)
  To: zsh-users

Hi,

I'm reading the guide and find it's not the case said in the guide page 132 about '<>' in-place editing.

% echo test > redirtest
% sed 's/e/Z/g' <> redirtest 1>&0
% cat redirtest
test
tZst

And looks like we can get the in-place editing by adding another '<> redirtest' in the end and turn off
multios:

% zsh -f 
localhost% unsetopt multios
localhost% echo test > redirtest
localhost% sed 's/e/Z/g' <> redirtest  1>&0 <> redirtest
localhost% cat redirtest
tZst
localhost%

So, it is the second '<> redirtest' reset the file offset of redirtest before sed outputs the result?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: editing file in-place with '<>'
  2014-06-23  8:06 editing file in-place with '<>' Han Pingtian
@ 2014-06-23  8:57 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2014-06-23  8:57 UTC (permalink / raw)
  To: zsh-users

On Mon, 23 Jun 2014 16:06:08 +0800
Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
> I'm reading the guide and find it's not the case said in the guide
> page 132 about '<>' in-place editing.
> 
> % echo test > redirtest
> % sed 's/e/Z/g' <> redirtest 1>&0
> % cat redirtest
> test
> tZst

Yes, I get that too.  It's possible this worked at the time but the
internals have changed.  It's a long time since I wrote that and it
really seems it's a bit messy to advise users to do it that way.

pws


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-23  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-23  8:06 editing file in-place with '<>' Han Pingtian
2014-06-23  8:57 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).