OK Hi peeps new to daniweb. I have a script missing for one of my classes because I missed due to work :( It's a very simple4 script (I think) It need to eccept the input of ten numbers compair them and output the highest number. This simpler the better here folks. Please Help. *Pulling Hair out!* :S
dewey_witt
0
Newbie Poster
Recommended Answers
Jump to PostHey There,
Assuming you're getting the variables from the command line
Ex: script 1 4 38 4 7 ...
#!/bin/ksh
highest_number=0
for x in $@
do
if [ $x -gt $highest_number ]
then
highest_number=$x
fi
done
print "Highest Number is $highest_number"Hope this helps :)
…
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.