Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Treat arguments as input stream in bash

Tags:

bash

Is there any bash trick that allows giving some parameters in command line to a program that gets its inputs via input stream? Something like this:

program < 'a=1;b=a*2;'

but < needs a file input stream.

like image 692
Mohammad Moghimi Avatar asked Feb 19 '26 00:02

Mohammad Moghimi


1 Answers

For very short here-documents, there are also here-strings:

program <<< "a=1;b=a*2"
like image 98
chepner Avatar answered Feb 21 '26 14:02

chepner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!