So python has a convenient function as part of pwntools where one can sendline() to an executable. How can I emulate this functionality in bash?
Example
#whatever.py
x = input("First input please: ")
y = input("Second input please: ")
I know I can echo "input1" | python3 whatever.py to answer the first input, but I can't make it work multiline (echo "input1\ninput2" | ... doesn't work, and neither does echo "input1"; echo "input2" | ...).
echo -eto interpret the\nas a newline. Or better useprintf '%s\n' input1 input2- see Why is printf better than echo? – steeldriver Apr 30 '22 at 16:52( echo "input1" ; echo "input2" ) | ...or{ echo "input1" ; echo "input2" } | ...(with the parentheses/braces) work for your use case? – frabjous Apr 30 '22 at 17:58{ }you need;or newline after second (echo) command; with( )you don't – dave_thompson_085 May 01 '22 at 02:25