How to send a command to /dev/ttyXX

How to send a command /dev/ttyXX.

I've tried these and none seem to worK;
1. echo "stop" > ttyS1
2. echo -ne "stop\n" > ttyS1
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dr. KlahnPrincipal Software EngineerCommented:
The linux "echo" command operates only on its host terminal.  Try putting text into a file, and then

cp (filename) /dev/ttyS1
Duncan RoeSoftware DeveloperCommented:
You cannot do what you have asked. The only way to get input to ttyS1 is to provide it on the associated serial interface (if there is one).
echo bar > foo and cp baz foo (where baz contains the single line bar) are identical in effect.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Duncan RoeSoftware DeveloperCommented:
Your command echo "stop" > ttyS1 would have worked in that a serial device attached to that connection would have received "stop\n". I don't have a serial port, so I sent to tty1 (console 1) instead. Then I switched to console 1 by Ctr-Alt-F1 and could see that "stop" was displayed.
Duncan RoeSoftware DeveloperCommented:
The question author has not seen fit to comment, so we have to assume he is satisfied with the answer provided.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.