Skip to content
Advertisement

Sending a command to screen in linux

In order to run a data analysis program, installed on a Teensy 2.0 microcontroller running arduino, I have to go to the screen by typing

screen -S trans -L /dev/ttyACM0 (the name of the screen is trans).

Once in the new screen, I have to enter ‘s’ to start the scanning process. I am trying to write a script to automate the process of writing commands, but cannot figure out how to pass ‘s’ into the screen to automatically begin the scanning process. I have tried commands such as

screen -S trans -X stuff "s$(printf \r)"

echo "s" > /dev/ttyACM0

I’m working on a Linux Ubuntu OS. Any help would be appreciated.

Advertisement

Answer

What you want is

screen -S trans -X stuff 'command'$(echo -ne '15')

i.e

screen -S trans -X stuff 's'$(echo -ne '15')

in your case. Let me know if this works for you.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement