次のスクリプトがあります。
while true; do
echo "# Available tests:"
PS3="Please select which test must be performed [1-9]: "
options=("CPU Stress Test (local)" "Memory Stress Test (local)" "Intensive Random Write I/O on disks (5 min) (local)" "Intensive Random Read I/O on disks (5 min) (local)" "Intensive Read I/O on disks (5 min) (local)" "Intensive Write on disks I/O (5 min) (local)" "Cache Read Capability (local)" "Measure Network Bandwidth (Between nodes)" "Quit")
select opt in "${options[@]}"
do
case $opt in
"CPU Stress Test (local)")
sleep 2
cpu
cleanup
;;
"Memory Stress Test (local)")
sleep 2
memory
cleanup
;;
"Intensive Random Write I/O on disks (5 min) (local)")
prereq
cslist
randwrite
sleep 2
;;
"Intensive Random Read I/O on disks (5 min) (local)")
sleep 2
;;
"Intensive Read I/O on disks (5 min) (local)")
sleep 2
;;
"Intensive Write on disks I/O (5 min) (local)")
sleep 2
;;
"Cache Read Capability (local)")
sleep 2
;;
"Measure Network Bandwidth (Between nodes)")
sleep 2
;;
"Quit")
echo "All right, bye bye! :)"
echo "Exiting..."
sleep 2
exit 1
;;
*) echo "Invalid option ($REPLY)";;
esac
done
done
たとえば、オプション1を選択するとCPU Stress Test (local)
正常に実行されますが、最終的にはPS3
オプションなしで私の問題のみが表示されますselect opt in...
。誰でも助けることができますか?
ありがとう
答え1
これselect
break
コマンドを実行する前に構成は終了しません。。
したがって、各タスクが完了したら、break
次のコマンドを使用します。
case $opt in
"CPU Stress Test (local)")
sleep 2
cpu
cleanup
break
...