hey, guys im new to UNIX and i need help.. I need to write a script which will tell you if you entered an even (e.g., 2, 4, 6...) or odd number (e.g., 1, 3, 5...) and then give you the summation of the number you entered. For example, if you entered 5 it will give 15 (1+2+3+4+5). I'm suppose to use if and loops .. I got no idea on how to do so.. below is what I got sooo far!
#!/bin/bash
echo " This script will tell you if you entered an even (e.g., 2, 4, 6...) or odd number (e.g., 1, 3, 5...) and then give you the summation of the number you entered. For example, if you entered 5 it will give 15 (1+2+3+4+5)"
echo "Please, enter your name and PRESS ENTER"
read name
echo 'Please, enter an integer number (e.g., 1, 2, 3...) and PRESS ENTER:'
fi
and I am to follow this example!
This script will tell you if you entered an even (e.g., 2, 4, 6...) or odd number (e.g., 1, 3, 5...) and then give you the summation of the number you entered. For example, if you entered 5 it will give 15 (1+2+3+4+5)
Please, enter your name and PRESS ENTER
name
Please, enter an integer number (e.g., 1, 2, 3...) and PRESS ENTER: 6
name you have entered 6 please see the results
The number you entered 6 is an even number
The summation of 6 is 21
anyone? please help!! lol