我不确定为什么我没有从此脚本中收到任何错误或任何回显信息。这是我们应该纠正剧本中错误的练习之一。我只需轻推一下就能指出正确的方向。
#!/bin/bash
clear
echo
while [ "$CHOICE" = "y" ]
do
# Rocket ship count down code
for num in {1..5}
do
echo "$num ..."
sleep 1
done
echo
echo -n 'We have main engine start.'
# Rocket ship powering up
for num in {1..3}
do
echo -n ". "
sleep 1
done
# End rocket ship powering up loop
echo -e '\e[1;31mlift off!\e[0m'
echo
# Loop to build rocket ship
################################################## Do not alter the code between these hash marks ###################################################
for rocket_ship_part in '\e[1;30m A \e[0m' '\e[1;30m / \ \e[0m' '\e[1;30m |=| \e[1;30m' '\e[1;30m |\e[1;31mU\e[0m\e[1;30m|' \
'\e[1;30m |\e[1;34mS\e[0m\e[1;30m|' '\e[1;30m |\e[1;32mA\e[0m\e[1;30m|' '\e[1;30m _|=|_ ' '\e[1;30m / | | \ ' '\e[1;30m | \|/ | ' \
'\e[1;30m |/"\e[1;31m"\e[0m"\| ' '\e[1;31m """ \e[0m' '\e[1;31m """ \e[0m' '\e[1;31m " \e[0m' '\e[1;31m " \e[0m' '\e[1;31m . \e[0m' \
'\e[1;31m . \e[0m' '\e[1;31m . \e[0m' '\e[0;31m . \e[0m' '\e[0;31m . \e[0m' '\e[0;30m . \e[0m' '\e[0;30m . \e[0m'
################################################## Do not alter the code between these hash marks ###################################################
do
echo -e "$rocket_ship_part"
sleep 1
done
# Up, up and away!
for altitude in {1..30}
do
echo
sleep 0.5
done
clear
echo 'To the stars and beyond!'
echo
echo -n "Do ypu want to launch the rocket again? (y/n) "
read CHOICE
clear
done
答案 0 :(得分:0)
params[:namespace][:q]
永远不会$CHOICE
,因此它永远不会进入y
- 循环。