0

I have an application built in C that uses fgets to read user commands from stdin. I want my embedded linux system to launch this application on startup, and put the user in the terminal of this application.

I can launch the application on startup using a bash script:

./my_app

but the application does not seem to be getting stdin from the user terminal.

If I wait to log in to linux, and then launch the application manually from the terminal, I can interact with it just fine.

Is there any way to launch the program automatically (such as with a startup script) but then pass over control to the user, as if the user had launched the program themself?

0

I found what I was looking for:

exec ./my_app

replaces the normal linux terminal with the application. The downside is that you cannot Ctrl + C back out into Linux, but that's not important for me, so this gets the job done.

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.