Ptheguy
Ptheguy

Reputation: 523

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.

Upvotes: 0

Views: 473

Answers (1)

likewhoa
likewhoa

Reputation: 123

What you want is

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

i.e

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

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

Upvotes: 1

Related Questions