TransWikia.com

Enter text into executable file immediately after it's run

Unix & Linux Asked by The Codesee on November 6, 2021

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.

One Answer

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

echo "code" | ./file 

Answered by Artem S. Tashkinov on November 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP