This commit is contained in:
2024-10-29 06:33:13 -06:00
parent 69da723d3c
commit eff6783ad2
3 changed files with 45 additions and 32 deletions
Executable → Regular
+19 -22
View File
@@ -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" subprocess() {
read -p baud echo "\nChanging ESPBAUD\n\t1: 9600\n\t2: 115200\n\t3: 230400\n\t4: 460800\n\t5: 1152000\n\t6: 1500000\n\nEnter Selection: "
if [[ $baud == "1" ]]; then read baudRate
selection=9600 echo "\n"
elif [[ $baud == "2" ]]; then case $baudRate in
selection=115200 1) selection=9600 ;;
elif [[ $baud == "3" ]]; then 2) selection=115200 ;;
selection=230400 3) selection=230400 ;;
elif [[ $baud == "4" ]]; then 4) selection=460800 ;;
selection=460800 5) selection=1152000 ;;
elif [[ $baud == "5" ]]; then 6) selection=1500000 ;;
selection=1152000 esac
elif [[ $baud == "5" ]]; then
selection=1152000
elif [[ $baud == "6" ]]; then
selection=1500000
else
echo "\nBad Selection\n"
return
fi
echo "\n$selection\n" return $selection
}
export ESPBAUD=$selection subprocess
ret=$?
export ESPBAUD=$ret
echo "\nBaudrate set to $ESPBAUD\n"
echo "\nAll done :3\n" echo "\nAll done :3\n"
+3
View File
@@ -0,0 +1,3 @@
import os
os.environ['SILLY'] = 'IAMASILLYFILLY'
print("SILLY = ", os.environ['SILLY'])
Regular → Executable
+20 -7
View File
@@ -1,10 +1,23 @@
#!/bin/bash subprocess() {
set -e 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) subprocess
echo "Script location: ${BASEDIR}" ret=$?
DIR="$( cd "$( dirname "$0" )" && pwd )" export ESPBAUD=$ret
echo $DIR
echo "\nBaudrate set to $ESPBAUD\n"
echo "\nAll done :3\n"