1

Hey so I'm extremely new to unix, and I grasp the basics, but I'm stuck at this one part.

So I'm to input values (letters) and sort them, without using the sort method. I considered changing the values of the letters to ACSII values and using if statements in that manner.

Is this the right way to go about this? I know this is how you do it for numbers

echo Enter 2  numbers with spaces in between
read a b 
l=$a
if [ $b -gt $l ]
then
l=$b
fi
echo Largest of $a $b is $l

so I'm ASSUMING converting them to values would make sense. I know in java I would do something similar. Again, I'm pretty new.

0

1 Answer 1

2

test, e.g., "[" and "]" assumes the operands are integers, which does not sound like what you want. expr can sort letters, using syntax like

if expr $b \> $l

I ran into an amusing problem with a shell which confused the two - see my notes

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.