made changeport work

This commit is contained in:
2024-10-29 07:04:30 -06:00
parent eff6783ad2
commit 2c779ed536
3 changed files with 48 additions and 36 deletions
+1
View File
@@ -1 +1,2 @@
test-scratch.sh test-scratch.sh
notes.txt
+24 -13
View File
@@ -1,16 +1,27 @@
echo "\nChanging ESPPORT\n" subprocess() {
echo "TTY devices found in dmesg:" echo "\nChanging ESPPORT\n"
COUNTER=0 echo "TTY devices found in dmesg:"
devarr=() COUNTER=0
for line in $(dmesg | tail -50 | grep -o -E "tty[A-Z]{3}[0-9]{0,2}" | sort -u); do devarr=()
echo "$COUNTER /dev/$line" for line in $(dmesg | tail -50 | grep -o -E "tty[A-Z]{3}[0-9]{0,2}" | sort -u); do
devarr+=("/dev/$line") echo "$COUNTER /dev/$line"
COUNTER=$((COUNTER+1)) devarr+=("/dev/$line")
done COUNTER=$((COUNTER+1))
done
echo "\nEnter TTY Number You'd Like:"
read tty
sel=$tty+1
eval "$1=$devarr[$sel]"
return 0
}
ret=''
subprocess ret
export ESPPORT=$ret
echo "\nEnter TTY Number You'd Like:"
read tty
ttyselect=$devarr[(($tty+1))]
export ESPPORT="${ttyselect}"
echo "\nESPPORT set to ${ESPPORT}\n" echo "\nESPPORT set to ${ESPPORT}\n"
echo "\nall done :3\n" echo "\nall done :3\n"