LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash: How to concatenate the output of different commands? (https://www.linuxquestions.org/questions/programming-9/bash-how-to-concatenate-the-output-of-different-commands-115538/)

J_Szucs 11-13-2003 07:35 AM

Bash: How to concatenate the output of different commands?
 
I want to concatenate the output of an echo and a grep command, and pipe them to smbclient, which shall send them as a message.

I tried:
echo "sometext" ; grep searchstring /path/to/file | smbclient -M addressee

The above command printed "sometext" onto the screen, and only piped the output of the grep command to smbclient to send it as a message.

Also, I want to put a newline in the message between the output of the echo and grep commands. (Naturally, newlines in the output of the grep command should also be kept)

Anyone knoing how to do this?

acid_kewpie 11-13-2003 07:43 AM

(echo -e "blah\n"; grep something) | smbclient....

should do you fine, i can never get newline's in echo right though... so don't quote me on that bit.


All times are GMT -5. The time now is 05:09 PM.