Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to pipe multiple inputs into one program? [closed]

Tags:

c

bash

pipe

I have a C program that takes in 2 separate inputs through the read(0,buffer,size(buffer)) function. They take two different inputs. Is it possible, through bash command only, to pipe two pytho -c or perl -e scripts into the C program? Or do I have to change its source code? Thanks in advance

like image 305
Yicheng Wang Avatar asked Dec 05 '22 23:12

Yicheng Wang


1 Answers

You can use a command group

{
   echo "First command"
   echo "Second command"
} | nl

Or on one line for your interactive editing convenience:

{ echo "First"; echo "Second"; } | nl
like image 196
that other guy Avatar answered Dec 31 '22 02:12

that other guy