LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   bash: how to redirect to file verbose output of mailx? (http://www.linuxquestions.org/questions/linux-general-1/bash-how-to-redirect-to-file-verbose-output-of-mailx-707804/)

val3xiv 02-26-2009 02:49 PM

bash: how to redirect to file verbose output of mailx?
 
Hi all.
I'm using mailx for sending mail through an external SMTP server and it working fine. The only thing I cannot do is to redirect the verbose output of mailx command to a file.

Code:

echo 'message body' | mailx -n -v -S verbose=1 -S smtp=isp.smtp.server -S smtp-auth-user=smtp.user -S smtp-auth-password=smtp.password -a file.to.attach -s "message subject" -r sender@address destination@address
The command above works ok, the mails are sent correctly and I can see on my screen the progress of the process. I tried to redirect it on a log file in various ways but nothing to do.
I tried:
Code:

>myfile
1>myfile
3>myfile
| tee myfile

every time I see the output on the screen and myfile is empty.
What I would to do is to redirect the output from screen to file, I don't wanna get response on the screen, just on the file.

Any ideas.
Thanks

val3xiv

colucix 02-26-2009 02:59 PM

Did you try to redirect the standard error?
Code:

2> myfile

val3xiv 02-26-2009 06:00 PM

Oh my god! It works!
I was really stupid for not trying it, but I didn't figure they could be managed as error messages.
Thank you very much colucix
(I think you are italian like me, maybe one day I could pay for this hel with a beer LOL)

val3xiv

colucix 02-26-2009 07:02 PM

Quote:

Originally Posted by val3xiv (Post 3458767)
(I think you are italian like me, maybe one day I could pay for this hel with a beer LOL)

val3xiv

He he... ok! Salute! :)


All times are GMT -5. The time now is 03:54 PM.