Skip to content

Instantly share code, notes, and snippets.

@paulsc
Created January 21, 2020 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulsc/212b792f4f94dab475ccad46c52d38d5 to your computer and use it in GitHub Desktop.
Save paulsc/212b792f4f94dab475ccad46c52d38d5 to your computer and use it in GitHub Desktop.
#!/bin/sh
PORTS=`ls /dev/cu*USB* 2> /dev/null`
if [ $? -eq 1 ]; then
PORTS=`ls /dev/cu*usb* 2> /dev/null`
if [ $? -eq 1 ]; then
echo "No USB serial port found."
exit 1
fi
fi
IDX=1
for port in $PORTS; do
echo $IDX: $port
IDX=$((IDX+1))
done
printf "Pick one: "
read SELIDX
IDX=1
for port in $PORTS; do
if [ $IDX -eq $SELIDX ]; then
echo "Connecting to $port... Ctrl A+K to quit"
sleep 1
screen $port 115200 -L
break
fi
IDX=$((IDX+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment