Sample Header Ad - 728x90

How to use sh script to send hex data to /dev/ttyUSB0?

1 vote
3 answers
8155 views
I'm working with a paired down embedded Linux installation that does not support bash, only sh across a ssh terminal. I need to send hex data to a connected USB device /dev/ttyUSB0. I'm able to do this easily enough with bash (on a desktop installation of Ubuntu 18.04) using echo -en '\x01\x02\x03' > /dev/ttyUSB0, but it seems that the backslash escapes are not supported by sh. Is there another relatively easy (or even not-so-easy) way to do this with sh? Unfortunately, $SHELL --version is not returning anything. Kernel version is 4.1.0.
Asked by Jim Fell (285 rep)
May 24, 2022, 10:15 PM
Last activity: May 25, 2022, 07:24 PM