Redirect stderr into becoming dots in Bash
2nd of September 2006
Here's a whacky idea; in a shell script I want to convert every line of stderr into a . on the same line. I'm still a shell scripting newbie but I know that bash can be quite powerful if you know what you're doing to it.
To begin with I've written a little wrapper on cvs commit called ~/bin/cvs_commit which does the following:
#!/bin/sh cvs commit -m "$1" | grep -v '\.bak*' | grep -v '\.pyc'
Because cvs prints all folders it recursively traverses I if it's a big tree all of that ugly stuff is print to screen via stderr. To get rid of that, I've changed my command to:
#!/bin/sh cvs commit -m "$1" 2>> /dev/null \ | grep -v '\.bak*' | grep -v '\.pyc'
Let's improve even more...
When you do a svn commit -m "" you get lots of little dots being printed slowly like this:
$ svn commit -m "" Sending OCH/sqlprofiling-och.log Transmitting file data ...
I like that. To be able to do too I was thinking that one could redirect every line of stderr through a function that converts it to . without a linebreak and the lastly redirects it back out to stdout.
How? Can anybody help me??