I have an executable file file that I am running by typing ./file into the terminal. When the program runs, I have to type in the text "code". However, the time taken to type it, or paste it into the terminal, results in the program saying "sorry, you took too long!".

I am tying to send the text "code" to the executable file when I run it, as therefore it would be inputted into the program immediately once it's run.

I've tried ./file; "code" and ./file && "code" but have had no luck - the program still wants an input.

  • 3
    Are you looking for echo "code" | ./file ? – Artem S. Tashkinov Jul 21 '20 at 11:40
  • @ArtemS.Tashkinov Brilliant! That's it, thanks very much – The Codesee Jul 21 '20 at 11:41

You may want to use the pipeline feature https://en.wikipedia.org/wiki/Pipeline_(Unix) :

echo "code" | ./file 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.