Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash output to file

Tags:

linux

bash

wine

i have the following statement

 for i in `cat i.txt`; do wine ~/run.exe $i.asc >> out.asc; done

but it keeps writing all the output to console not the file 'out.asc'. plz can you help me to redirect the output to file rather than screen. thanks in advance!

like image 840
poi Avatar asked Jul 30 '26 23:07

poi


2 Answers

It might be that wine is writing to stderr, so you need to redirect that:

for i in `cat i.txt`; do wine ~/run.exe $i.asc 2>> out.asc; done

Notice the 2 in the 2>> operator, this means stderr.

like image 108
unwind Avatar answered Aug 01 '26 12:08

unwind


try with redirecting stderr (2) to stdout (1)

for i in `cat i.txt`; do wine ~/run.exe $i.asc >> out.asc 2>&1; done
like image 44
Cédric Julien Avatar answered Aug 01 '26 13:08

Cédric Julien



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!