다음 스크립트가 있습니다.
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
...