Skip to content

Instantly share code, notes, and snippets.

@frojnd
Created April 2, 2020 14:02
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 frojnd/ce5aef030c17f448d235fccb4a38cd85 to your computer and use it in GitHub Desktop.
Save frojnd/ce5aef030c17f448d235fccb4a38cd85 to your computer and use it in GitHub Desktop.
#!/bin/bash
function loop_through_tty {
log_path="$HOME/logs"
if [ ! -d "$log_path" ]; then
mkdir $log_path
fi
while true
do
mapfile -t ttys_path < <(find /dev/ -name "ttyUSB*")
for i in "${ttys_path[@]}"; do
printf "%s \n" "I found: $i"
echo ${i##*/}
picocom -b 115200 -l $i --logfile $log_path/picocom${i##*/}.log
done
done
}
loop_through_tty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment