Bash Script Using For Loop
Create a Bash script named ~/project/for_example.sh
that uses a 'for' loop to iterate ten times and print each value of the 'counter' variable on a single line.
Requirements
To successfully complete this challenge, the script should:
- Use a 'for' loop that iterates ten times
- Declare a 'counter' variable that starts at 10 and decrements by 1 with each iteration
- Print each value of the 'counter' variable on a single line, separated by spaces
Example
To run the script, use the following command:
bash for_example.sh
Output:
10 9 8 7 6 5 4 3 2 1
The script will output the values from 10 to 1 on a single line.