bug-bash
[Top][All Lists]
Advanced

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

Appending transformed into truncation


From: evanm
Subject: Appending transformed into truncation
Date: Mon, 29 Sep 2003 15:06:33 -0700
User-agent: Mutt/1.4i

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.

#!/bin/bash
echo truncate >&2

and echo data>test; ./iobug.sh 2>>test; cat test

works as expected. Can someone explain this?





reply via email to

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