Created
January 20, 2017 14:47
-
-
Save nlm/01dd9cd614e528c2213cf379c99ddf26 to your computer and use it in GitHub Desktop.
Login Shell to automatically connect to serial port via ssh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
name="$(basename $0)" | |
echo "$name" | |
if [[ "$name" =~ serialsh-(tty[a-zA-Z0-9]+)(-([0-9]+))? ]]; then | |
tty="${BASH_REMATCH[1]}" | |
speed="${BASH_REMATCH[3]}" | |
exec screen -dR "serialsh-${tty}" "/dev/${tty}" $speed | |
else | |
echo "usage: $0" | |
echo "symlink this file as serialsh-tty0 to access tty0" | |
echo "symlink this file as serialsh-ttyUSB0-115200 to" | |
echo " access /dev/ttyUSB0 at 115200 bauds" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment