uuencode text.txt | mail -s "hai" "[email protected]" < 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?
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:
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