Created
August 22, 2020 22:58
-
-
Save niuage/9ec29cef9b9777737830f127fed3fafa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Puts this code in a file (you can name it "count" or something), then give it the proper permissions with this command: | |
# chmod 755 count | |
# Then you can run it with: ./count | |
#!/bin/bash | |
echo Enter a number: | |
read input_number | |
max=$[$input_number+100] | |
echo You entered $input_number. Let\'s count to $max. | |
# initializes i to be the number the user entered | |
i=$input_number | |
# displays the current number i and then increment it for the next iteration | |
while [ $i -le $max ] | |
do | |
echo $i | |
i=$[$i+1] | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment