echo "Please enter four numbers: \c"
for i in 1 2 3 4
[ $number -gt $max ] && max=$number
echo "The maximum is: $max"
When I run it, for example, I type 1 2 3 4 and it does nothing...
on 04/30/2012 – Made popular on 04/30/2012
I am trying to calculate the maximum number from four numbers input by the user. I have the following code, but it does not work. It says there's an error with the last line "done". Any help would be appreciated.
I am trying to create a script using for loop where the user gets prompted for a number. That number must then be multiplied by 1 through to 10 and displaying the answer each time. I am confused though, here is what I have done.
Hello there, I am posting to seek help with a KSH script,
I am making a simple calculation program where the user can enter as many numbers as they like, I am getting their input using the read command, however I am not sure how to repeat doing this and storing the input in to new variables until the user wants the program to calculate.
I've been working on a few scripts and have been getting great info.
How, would I include in the below script, how I would let a user know that if they divide a SECOND number by zero, that they would get a divide by zero error? What's the easiest way of working this?
I think I asked this and didn't get a viable answer before. 'Trying again.