On 25 May 2012 14:09, RW <[email protected]> wrote:
> 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

Perhaps.  Just being overcautious, sorry :)

Chris
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "[email protected]"

Reply via email to