|
CS469/569 - Linux and Unix Administration and Networking
Spring 2022
|
Displaying ./code/h5/b.sh
#!/bin/bash
# (2 points)
# Prompt the user for a start/end numbers and print all the odd numbers between
# them. If start > end, switch start and end.
# Example output:
# > ./b.sh
# Start? 0
# End? 20
# 1 3 5 7 9 11 13 15 17 19
# Use read to prompt for a start and ending value:
# If the start > end, switch the two:
# If start is an even number, increment by one:
# Use a C style for loop to loop through the odd numbers until start > end.
# Increment start by two each time through the loop. Use echo to print the
# number followed by a space, but without a newline.
# After the loop is finished use echo to print a newline.
|