2024-07-23 20:50:16 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if ! command -v sudo &> /dev/null; then
|
|
|
|
echo "sudo未安装,部分命令无法正常运行"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
declare -a pick_array
|
2024-07-24 00:56:26 +08:00
|
|
|
declare pick_number
|
2024-07-23 20:50:16 +08:00
|
|
|
declare pick
|
2024-07-24 00:56:26 +08:00
|
|
|
|
|
|
|
while true
|
|
|
|
do
|
|
|
|
|
|
|
|
pick_number=0
|
2024-07-23 20:50:16 +08:00
|
|
|
echo "======Linux工具箱======"
|
2024-09-21 14:17:49 +08:00
|
|
|
cd Menus || exit
|
2024-07-23 20:50:16 +08:00
|
|
|
for i in *
|
|
|
|
do
|
|
|
|
pick_number=$((pick_number + 1))
|
|
|
|
pick_array[$pick_number]=$(awk -F '.' '{print $1}' <<< "$i")
|
|
|
|
echo "${pick_number}.${pick_array[$pick_number]}"
|
|
|
|
done
|
|
|
|
cd - >> /dev/null
|
|
|
|
echo "======Linux工具箱======"
|
|
|
|
read -p "请输入要使用的功能:" pick
|
|
|
|
if [[ "${pick}" -gt 0 && "${pick}" -le "${#pick_array[*]}" ]];then
|
|
|
|
clear
|
2024-09-21 14:17:49 +08:00
|
|
|
bash "${PWD}/Menus/${pick_array[$pick]}.sh"
|
2024-07-23 20:50:16 +08:00
|
|
|
else
|
|
|
|
exit
|
2024-07-24 00:56:26 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
done
|