Gaurav
Gaurav

Reputation: 1045

Append operator in bash shell

While running a bash shell script which contains this command:

iperf -c $server_ip -p $iperf_port -t $iperf_duration >> outputfile

the output is many times displayed on console rather than getting appended in the outputfile. Any solutions for same? Am I doing anything wrong? I am using Ubuntu 12.04

Upvotes: 0

Views: 1464

Answers (1)

ruakh
ruakh

Reputation: 183602

I'm not familiar with iperf, but presumably it's writing some or all of its output to standard-error rather than to standard-output. To merge standard-error with standard-output and send them both to your file, you can add 2>&1 to the end:

iperf -c $server_ip -p $iperf_port -t $iperf_duration >> outputfile 2>&1

Upvotes: 4

Related Questions