Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
uuencode text.txt | mail -s "hai" "abc@gmail.com" < body.txt

after executing this command, terminal is blank. It is not prompting for next command. I have to press ctrl+z to return to terminal.

What could be the problem?

share|improve this question

1 Answer 1

Well, you don't do it this way ;-) Nice try though!

You are using the pipe "|" to write the output of your uuencode command to the input channel (aka. stdin, standard input) of the mail command. You are also using the shell redirection "<" to write the file contents of body.txt to the input channel of you mail command.

This is ambiguous. I am not sure right now, what takes precedence, or how the shell handles the situation. You probably end up with one of the programs asking for input.

Better clarify for the shell, what to do, in what order. I.e. by writing:

(cat body.txt; uuencode text.txt) |mail -s "hai" "abc@gmail.com"

This executes cat (the file printer) and uuencode in one rush (in a subshell to be precise, due to the parenthesis) and pipes the common output to the mail program

share|improve this answer
    
I have tried what you told.But it is still showing the same blank page. pls tell me another solution. thank you –  Krishna Priya Oct 20 '13 at 6:14
    
Odd..., after rereading the man page, maybe use a plain echo to make sure the input ends with a newline, before stdin for the mail program is closed: (cat body.txt; uuencode text.txt; echo) |mail -s "hai" "abc@gmail.com" –  Paul Hänsch Oct 20 '13 at 11:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.