Bash Output Stream And Error Stream

I was trying to merge the output stream and the error stream as was shown in a book I was going through

The script is

time wc abc > wc.out 2>&1

However I was not able to so

I got the same output as time wc abc > wc.out

Is there a problem with my script>

On 06/15/10 22:16, manugupt1 wrote:
>
> I was trying to merge the output stream and the error stream as was
> shown in a book I was going through
>
> The script is
>
> TIME WC ABC > WC.OUT 2>&1
>
> However I was not able to so
>
> I GOT THE SAME OUTPUT AS TIME WC ABC > WC.OUT

No errors means no error output.

> Is there a problem with my script>

No.
Try the same with a non existing file(name).

Theo

Does not work as the time output is being redirected on the screen instead of the file

Note that there is a time builtin in bash. The one in /usr/bin/time does send output to stderr.

yes
generally the stderr is the output console in our case the monitor
however I want to merge the stdout and stderr but it is not working

This thread may be relevant to you. You may have to use the /usr/bin/time command instead of the bash builtin which doesn’t see to have any redirection capability.

bash: save in a variable the number of seconds a process took to run - Stack Overflow