再占一层。。。。
while true
do
read -p "Please input a number [ ${numbers} ]:" execshell
if [[ ! ${execshell} =~ ^[0-9]+ ]];then
exit 0
fi
/bin/sh ./${ssharray[$execshell]}
done
while true
do
read -p "Please input a number [ ${numbers} ]:" execshell
if [[ ! ${execshell} =~ ^[0-9]+ ]];then
exit 0
fi
/bin/sh ./${ssharray[$execshell]}
done
2016-01-24
挺好的,之前写的脚本都能用它控制了
#!/bin/bash
resettem=$(tput sgr0)
declare -A ssharray
i=0
numbers=""
for script_file in $(ls -I "monitor_man.sh" ./)
do
echo -e "\e[1;35m" "The Script:" ${i} '==>' ${resettem} ${script_file}
ssharray[$i]=${script_file}
numbers="${numbers} | ${i}"
i=$(( i+1 ))
done
#!/bin/bash
resettem=$(tput sgr0)
declare -A ssharray
i=0
numbers=""
for script_file in $(ls -I "monitor_man.sh" ./)
do
echo -e "\e[1;35m" "The Script:" ${i} '==>' ${resettem} ${script_file}
ssharray[$i]=${script_file}
numbers="${numbers} | ${i}"
i=$(( i+1 ))
done
2016-01-24