Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 May 2012 14:09:58 +0100
From:      RW <rwmaillists@googlemail.com>
To:        ports@freebsd.org
Subject:   Re: portdowngrade and meta ports
Message-ID:  <20120525140958.65863f97@gumby.homeunix.com>
In-Reply-To: <CADLo83_qqGmqkQR54DKa=RemB01zGniREowMzTH7t7c2yzTO6w@mail.gmail.com>
References:  <alpine.BSF.2.00.1205241335190.22032@abbf.ynefrvtuareubzr.pbz> <CADLo838ER8kAS276HTyEBFsW=UmjbcBKMrAjfzyJ%2B=JZt-F%2BtA@mail.gmail.com> <CADLo83_qqGmqkQR54DKa=RemB01zGniREowMzTH7t7c2yzTO6w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 24 May 2012 22:43:08 +0100
Chris Rees wrote:


> For the archive-- just thought-- even though I did a typo there,
> DON'T use:
> 
> mv file file.bak && echo something > file
> 
> at least with csh, file will be clobbered before mv gets to it....

I tried that in bash and csh and it worked correctly in both. 

e.g. in csh:

  %echo nothing > foo
  %mv foo bar && echo something > foo
  %cat foo
  something
  %cat bar
  nothing

If a shell supports short-circuiting then mv must complete before echo
can start, so I don't see how it can fail unless the shell opens the
file before it runs mv.

Are you perhaps mixing this up with what happens with:

 cat foo bar > foo




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120525140958.65863f97>