From eff6783ad2404b7006da2639398186b1bfa6e32d Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Tue, 29 Oct 2024 06:33:13 -0600 Subject: [PATCH] edrfgr --- custom_bin/changebaud | 47 ++++++++++++++++++++----------------------- custom_bin/export.py | 3 +++ test-scratch.sh | 27 ++++++++++++++++++------- 3 files changed, 45 insertions(+), 32 deletions(-) mode change 100755 => 100644 custom_bin/changebaud create mode 100644 custom_bin/export.py mode change 100644 => 100755 test-scratch.sh diff --git a/custom_bin/changebaud b/custom_bin/changebaud old mode 100755 new mode 100644 index 270388c..8754e01 --- a/custom_bin/changebaud +++ b/custom_bin/changebaud @@ -1,26 +1,23 @@ -echo "\nChanging ESPBAUD\n\t1: 9600\n\t2: 115200\n\t3: 230400\n\t4: 460800\n\t5: 1152000\n\t6: 1500000\n" -read -p baud -if [[ $baud == "1" ]]; then - selection=9600 -elif [[ $baud == "2" ]]; then - selection=115200 -elif [[ $baud == "3" ]]; then - selection=230400 -elif [[ $baud == "4" ]]; then - selection=460800 -elif [[ $baud == "5" ]]; then - selection=1152000 -elif [[ $baud == "5" ]]; then - selection=1152000 -elif [[ $baud == "6" ]]; then - selection=1500000 -else - echo "\nBad Selection\n" - return -fi - -echo "\n$selection\n" - -export ESPBAUD=$selection - +subprocess() { + echo "\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 "\n" + case $baudRate in + 1) selection=9600 ;; + 2) selection=115200 ;; + 3) selection=230400 ;; + 4) selection=460800 ;; + 5) selection=1152000 ;; + 6) selection=1500000 ;; + esac + + return $selection +} + +subprocess +ret=$? + +export ESPBAUD=$ret + +echo "\nBaudrate set to $ESPBAUD\n" echo "\nAll done :3\n" \ No newline at end of file diff --git a/custom_bin/export.py b/custom_bin/export.py new file mode 100644 index 0000000..ead1b89 --- /dev/null +++ b/custom_bin/export.py @@ -0,0 +1,3 @@ +import os +os.environ['SILLY'] = 'IAMASILLYFILLY' +print("SILLY = ", os.environ['SILLY']) \ No newline at end of file diff --git a/test-scratch.sh b/test-scratch.sh old mode 100644 new mode 100755 index 5434e02..c514ffa --- a/test-scratch.sh +++ b/test-scratch.sh @@ -1,10 +1,23 @@ -#!/bin/bash -set -e +subprocess() { + echo "\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 "\n" + case $baudRate in + 1) selection=9600 ;; + 2) selection=115200 ;; + 3) selection=230400 ;; + 4) selection=460800 ;; + 5) selection=1152000 ;; + 6) selection=1500000 ;; + esac -echo "Script executed from: ${PWD}" + return $selection +} -BASEDIR=$(dirname $0) -echo "Script location: ${BASEDIR}" +subprocess +ret=$? -DIR="$( cd "$( dirname "$0" )" && pwd )" -echo $DIR \ No newline at end of file +export ESPBAUD=$ret + +echo "\nBaudrate set to $ESPBAUD\n" +echo "\nAll done :3\n" \ No newline at end of file