Sample Header Ad - 728x90

Send more than one line to an executable using bash

1 vote
1 answer
2409 views
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" | ...).
Asked by belkarx (365 rep)
Apr 30, 2022, 04:47 PM
Last activity: Jan 14, 2025, 05:17 PM