From edc0c5b106d73f9c021fbcde68c68eaf9e1e8d1c Mon Sep 17 00:00:00 2001 From: lsy Date: Thu, 26 Sep 2024 08:55:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=BD=AF=E4=BB=B6=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Run.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Run.sh b/Run.sh index 383a118..8ee011b 100644 --- a/Run.sh +++ b/Run.sh @@ -9,23 +9,36 @@ declare -a pick_array declare pick_number declare pick declare path_script=$(dirname $0) +path_script="${path_script}/Config" +declare path_local=$path_script +declare file_name while true do - +if [[ -e "${path_local}/test.sh" ]]; then + bash "${path_local}/test.sh" +fi pick_number=0 -echo "======Linux工具箱======" -for i in "${path_script}/Menus"/* +echo "======$(basename $0 .sh)======" +for i in "${path_local}"/* do + file_name=$(awk -F '.' '{print $1}' <<< "$(basename $i)") + if [[ $file_name == "test" ]]; then + continue + fi pick_number=$((pick_number + 1)) - pick_array[$pick_number]=$(awk -F '.' '{print $1}' <<< "$(basename $i)") + pick_array[$pick_number]=$file_name echo "${pick_number}.${pick_array[$pick_number]}" done -echo "======Linux工具箱======" read -p "请输入要使用的功能:" pick if [[ "${pick}" =~ [1-${#pick_array[*]}] ]];then clear - bash "${path_script}/Menus/${pick_array[$pick]}.sh" "$path_script" + if [[ -d "${path_local}/${pick_array[$pick]}" ]]; then + path_local="${path_local}/${pick_array[$pick]}" + elif [[ -e "${path_script}/${pick_array[$pick]}.sh" ]]; then + bash "${path_script}/${pick_array[$pick]}.sh" + path_local=$path_script + fi else exit fi