简体   繁体   English

Shell脚本-无回声,无错误

[英]Shell Script - No echo and no errors

I'm not sure why i'm not getting any error or any echoed information from this script. 我不确定为什么我没有从该脚本中得到任何错误或任何回显信息。 It's one of those exercises where we are supposed to correct mistakes in the script. 这是我们应该纠正脚本中的错误的练习之一。 I just need a nudge to point me in the right direction. 我只需要轻推即可将我指向正确的方向。

#!/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

$CHOICE永远不是y ,所以它永远不会进入while循环。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM