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.
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 with C trying to get factorials which I've successfully accomplished but my code needs to output an error message when inputting negative numbers, unfortunately my code outputs an error when using 1 and 0.
This is what my code looks like (keep in mind I'm a beginner user so my code is simple).
The following code will split the infile into multiple files. However, I need it to insert the same first 3 lines from the original input file into each splitted file. How do I modify my script below to do so: