linuxtool/Run.sh

33 lines
707 B
Bash
Raw Normal View History

2024-07-23 20:50:16 +08:00
#!/bin/bash
2024-09-23 17:59:28 +08:00
if [[ $UID != 0 ]]; then
echo "请以root权限执行该脚本"
exit
2024-07-23 20:50:16 +08:00
fi
declare -a pick_array
declare pick_number
2024-07-23 20:50:16 +08:00
declare pick
2024-09-21 16:25:44 +08:00
declare path_script=$(dirname $0)
while true
do
pick_number=0
2024-07-23 20:50:16 +08:00
echo "======Linux工具箱======"
2024-09-21 16:25:44 +08:00
for i in "${path_script}/Menus"/*
2024-07-23 20:50:16 +08:00
do
pick_number=$((pick_number + 1))
2024-09-21 16:07:27 +08:00
pick_array[$pick_number]=$(awk -F '.' '{print $1}' <<< "$(basename $i)")
2024-07-23 20:50:16 +08:00
echo "${pick_number}.${pick_array[$pick_number]}"
done
echo "======Linux工具箱======"
read -p "请输入要使用的功能:" pick
if [[ "${pick}" -gt 0 && "${pick}" -le "${#pick_array[*]}" ]];then
clear
2024-09-21 16:28:01 +08:00
bash "${path_script}/Menus/${pick_array[$pick]}.sh" "$path_script"
2024-07-23 20:50:16 +08:00
else
exit
fi
done