bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Appending transformed into truncation


From: Chet Ramey
Subject: Re: Appending transformed into truncation
Date: Wed, 01 Oct 2003 17:03:21 -0400

> I discovered that, given a script as such:
> 
> #!/bin/bash
> echo truncate >&1
> 
> If it is invoked like so:
> 
> echo data>test; ./iobug.sh >>test; cat test
> 
> It will truncate the test file, rather than append to it. This is not
> behavior I would expect. I'm aware that it's a bit silly to redirect stdout
> to stdout, but I recently ran across a script where someone did something
> similar, which brought this to my attention.

You don't say which version of bash you're testing, but running that
pair of scripts with bash-2.05b results in

        data
        truncate

which is correct.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]