LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-26-2009, 02:49 PM   #1
val3xiv
Member
 
Registered: Jun 2007
Location: ita
Distribution: slackware
Posts: 35

Rep: Reputation: 15
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
 
Old 02-26-2009, 02:59 PM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,503

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Did you try to redirect the standard error?
Code:
2> myfile
 
Old 02-26-2009, 06:00 PM   #3
val3xiv
Member
 
Registered: Jun 2007
Location: ita
Distribution: slackware
Posts: 35

Original Poster
Rep: Reputation: 15
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
 
Old 02-26-2009, 07:02 PM   #4
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,503

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Quote:
Originally Posted by val3xiv View Post
(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!
 
  


Reply

Tags
bash, mail, mailx


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH: How to Redirect Output to File, AND Still Have it on Screen edwin11 Linux - Software 25 07-02-2012 06:12 PM
Bash Scripting: Redirect output of entire script to file & screen Kristijan Programming 1 09-11-2008 05:31 AM
bash input/output redirect problem greno Programming 2 12-31-2006 03:23 PM
How to redirect output to a file? mus1402 Linux - Newbie 2 02-05-2006 09:42 AM
Is there a way in Linux/Unix bash to turn off output or redirect to a file jimwelc Linux - Newbie 6 01-06-2005 03:56 AM


All times are GMT -5. The time now is 09:38 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration