How to I concatenate stdin to a string, like this?
echo "input" | COMMAND "string"
and get
inputstring
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A bit hacky, but this might be the shortest way to do what you asked in the question (use a pipe to accept
stdoutfromecho "input"asstdinto another process / command:Output:
What task are you exactly trying to accomplish? More context can get you more direction on a better solution.
Update – responding to comment:
@NoamRoss
The more idiomatic way of doing what you want is then:
The
$(...)syntax is called command substitution. In short, it executes the commands enclosed in a new subshell, and substitutes the itsstdoutoutput to where the$(...)was invoked in the parent shell. So you would get, in effect: