I don't have zsh available. I did notice that your {..}'d statement is not correct. You always need a semicolon before the closing `}'.
When I added that in bash, I could prove to my satisfaction that stderr was being redirected to stdout. Try { eval $cmd ; } 2>&1 | filter # ----------^ Also, you wrote Save all output of $cmd (form stderr and stdout) to a file $logfile I don't see any mention of $logfile in your code. You should be able to get all output into logfile (while losing the specficity of stderr stream), with yourCommand 2>&1 | tee ${logFile} | .... I hope this helps.P.S. as you appear to be a new user, if you get an answer that helps you please remember to mark it as accepted, and/or give it a + (or -) as a useful answer.
{ eval $cmd } works under zsh. $logfile appears in the filter alias. – Gilles Jun 10 at 23:20 Doah, Thanks for pointing that out.
– shellter Jun 11 at 1:27.
Don't use aliases in scripts, use functions (global aliases are especially looking for trouble). Not that you actually need functions here. You also don't need || true (unless you're running under set -e, in which case you should turn it off here).
Other than that, your script looks ok; what is it choking on? { eval $cmd } | tee $logfile | sed -n '/error\|warning/I,/^$/p' | tee $logfile:r. Stderr | grep --color -i -C 1000 error 1>&2 exit $pipestatus1 I'm also not sure what you meant by the sed expression; I don't quite understand your requirement 2.
The sed line prints out all lines with 'error' or 'warning' in it and all line that follow until an empty line. This does the first half of requirement 2. THe other half is with the 'grep --color ... 1>&2' – Slothman Jun 13 at 4:33 Gilles, thanks for the tip about || true.
I had setopt errexit set (the same as set -e). – Slothman Jun 13 at 4:49.
The original post was mostly correct, except for an optimization by Gilles (to turn off set -e so the || true's are not needed. #! /bin/zsh # using zsh 4.2.0 setopt no_multios #setopt no_errexit # set -e # don't turn this on { eval $cmd } 2>&1 | tee $logfile | sed -n '/error\|warning/I,/^$/p' | tee $logfile:r.
Stderr | grep --color -i -C 1000 error 1>&2 exit $pipestatus1 The part that confused me was the mixing of stdout and stderr led to them being interleaved and the sed -n '/error\|warning/I,/^$/p' (which prints out from and error || warning to the next empty line) was printing out a lot more than expected which made it seem like the command wasn't working.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.