diff --git a/custom_bin/changebaud.sh b/custom_bin/changebaud.sh index 9f94f9e..c2dab30 100644 --- a/custom_bin/changebaud.sh +++ b/custom_bin/changebaud.sh @@ -1,4 +1,4 @@ -subprocess() { +function subprocess() { echo -e "\nChanging ESPBAUD\n\t1: 9600\n\t2: 115200\n\t3: 230400\n\t4: 460800\n\t5: 1152000\n\t6: 1500000\n\nEnter Selection: " read baudRate echo -e "\n" @@ -12,7 +12,7 @@ subprocess() { esac eval "$1=$selection" - return 0; + return 0 } if [ ! -z "$1" ]; then @@ -22,7 +22,6 @@ else subprocess ret fi -echo "ret: $ret" export ESPBAUD=$ret -echo "\nBaudrate set to $ESPBAUD\n" -echo "\nAll done :3\n" \ No newline at end of file +echo -e "\nBaudrate set to $ESPBAUD\n" +echo -e "\nAll done :3\n" \ No newline at end of file diff --git a/custom_bin/changeesp.sh b/custom_bin/changeesp.sh index 875026b..f08801b 100644 --- a/custom_bin/changeesp.sh +++ b/custom_bin/changeesp.sh @@ -1,4 +1,4 @@ -subprocess() { +function subprocess() { echo -e "\nChanging ESPTARGET\n" echo -e "Set esp target (esp32, esp32s3, esp32c6, esp8266, etc)" read esp diff --git a/custom_bin/changeport.sh b/custom_bin/changeport.sh index 50c030e..7af8419 100644 --- a/custom_bin/changeport.sh +++ b/custom_bin/changeport.sh @@ -1,4 +1,4 @@ -subprocess() { +function subprocess() { echo -e "\nChanging ESPPORT\n" echo -e "TTY devices found in dmesg:" COUNTER=0 diff --git a/esp-idf-tools-cmd.sh b/esp-idf-tools-cmd.sh index 0e8f5fe..1e23c45 100644 --- a/esp-idf-tools-cmd.sh +++ b/esp-idf-tools-cmd.sh @@ -120,18 +120,13 @@ function messagePTS() { else message="Something happening! Maybe a shutdown!" fi - - echo -e "\n\npts $(ls -q /dev/pts)\n\n" - + for pts in $(ls -q /dev/pts); do - if [[ $pts =~ '^[0-9]+$' ]] && [[ "/dev/pts/$pts" != "$(tty)" ]]; then - echo -e "\n\npts running $pts\ntty running: $(tty)\n\n"; - + if [[ "$pts" =~ ^[0-9]+$ ]] && [[ "/dev/pts/$pts" != "$(tty)" ]]; then sudo echo -e "$message" > /dev/pts/$pts # requires passwordless sudo writeToLog "PTS Message: $message send to /dev/$pts" fi done - } # this is not needed so long as warn doesnt god damned fucking work lmfao diff --git a/test-scratch.sh b/test-scratch.sh index 44150fa..98aac16 100755 --- a/test-scratch.sh +++ b/test-scratch.sh @@ -1,19 +1,28 @@ #!/bin/bash +function subprocess() { + echo -e "\nChanging ESPBAUD\n\t1: 9600\n\t2: 115200\n\t3: 230400\n\t4: 460800\n\t5: 1152000\n\t6: 1500000\n\nEnter Selection: " + read baudRate + echo -e "\n" + case $baudRate in + 1) selection=9600;; + 2) selection=115200;; + 3) selection=230400;; + 4) selection=460800;; + 5) selection=1152000;; + 6) selection=1500000;; + esac -function test_fun() { - echo "function name? $0" + eval "$1=$selection" + return 0 } -echo "script name? $0" -test_fun -test_fun "one" "two" 3 - -if [[ ! -z $1 ]]; then - message="$1" +if [ ! -z "$1" ]; then + ret="$1" else - message="PTS Default Message" + ret='' + subprocess ret fi -for pts in $(ls -q /dev/pts); do - sudo echo "$message" > /dev/pts/$pts -done +export ESPBAUD=$ret +echo -e "\nBaudrate set to $ESPBAUD\n" +echo -e "\nAll done :3\n" \ No newline at end of file