Skip to content

Instantly share code, notes, and snippets.

@rlcamp
Last active July 31, 2020 17:10
Show Gist options
  • Save rlcamp/8cd286056fc9f913ab618e78eec52325 to your computer and use it in GitHub Desktop.
Save rlcamp/8cd286056fc9f913ab618e78eec52325 to your computer and use it in GitHub Desktop.
Get around the "stty not persistent" issue on macOS
#!/bin/bash
# Get around the "stty not persistent" issue on macOS (works fine on linux too)
# Usage: ./catty.sh /dev/cu.SLAB_USBtoUART 115200
exec 3<>$1
stty speed $2 <&3 >/dev/null
exec cat <&3
#!/bin/bash
# Usage: ./zmodem_get.sh /dev/cu.SLAB_USBtoUART 115200 /path/to/remote/filename
# assuming the far end of the serial device is already sitting at a prompt
exec 3<>${1}
stty speed ${2} <&3 1>/dev/null
echo "sz -b -e ${3}" >&3
exec rz >&3 <&3
#!/bin/bash
# Usage: ./zmodem_put.sh /dev/cu.SLAB_USBtoUART 115200 /path/to/local/filename
# assuming the far end of the serial device is already sitting at a prompt
exec 3<>${1}
stty speed ${2} <&3 1>/dev/null
echo "rz" >&3
exec sz -b -e ${3} >&3 <&3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment