Created
April 3, 2020 13:29
-
-
Save frojnd/d90892169fe51bbac1ca817a808cc65e to your computer and use it in GitHub Desktop.
This file contains 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
function loop_through_tty { | |
log_path="$HOME/logs" | |
if [ ! -d "$log_path" ]; then | |
mkdir $log_path | |
fi | |
while true | |
do | |
for i in $(find /dev/ |grep ttyUSB); do | |
if [[ -z $(ps fax |grep picocom |grep $i |grep -v grep) ]]; then | |
screen picocom -b 115200 -l $i --logfile $log_path/picocom${i##*/}.log | |
fi | |
done | |
sleep 2s; | |
done | |
} | |
loop_through_tty | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment