mirror of
https://github.com/OpenMTC/OpenMTC.git
synced 2024-12-19 13:08:06 +00:00
36 lines
849 B
Bash
Executable File
36 lines
849 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
base_path=$(dirname "$(readlink -f "${0}")")
|
|
|
|
################################################################################
|
|
# set app_file
|
|
declare -a app_array
|
|
|
|
app_array=($(find ${base_path} -name "*.py"))
|
|
array_length=${#app_array[@]}
|
|
|
|
# print possibilities
|
|
for i in $(seq 1 ${array_length}); do
|
|
path=${app_array[$[${i}-1]]}
|
|
echo "[${i}] $(basename ${path})"
|
|
done
|
|
|
|
# read choice
|
|
while true; do
|
|
read -n 2 -p "Choose the app to start: " choice
|
|
|
|
[[ ${choice} =~ ^[0-9]+$ ]] && \
|
|
[ ${choice} -gt 0 -a ${choice} -le ${array_length} ] && \
|
|
echo && break
|
|
|
|
echo " Wrong choice. Do it again."
|
|
done
|
|
|
|
app_file=${app_array[$[${choice}-1]]}
|
|
|
|
################################################################################
|
|
# run app_file
|
|
cd ${base_path}
|
|
. ../../common/prep-env.sh
|
|
python ${app_file}
|