[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash Question



On Wed, 2017-07-05 at 23:12 +0200, Rainer Dorsch wrote:
> Hi,
>  
> can anybody help to explain what is going on here ?
>  
>  
> rd@mohot:~$ echo $SHELL 
> /bin/bash 
> rd@mohot:~$ if [ "abc" > "dec" ]; then echo bad; fi       
> bad 
> rd@mohot:~$ if [ "abc" < "dec" ]; then echo good; fi 
> good 
> rd@mohot:~$ 
> 
> How can abc sort before and after dec at the same time?
>  
> Thanks
> Rainer
>  
>  
> -- 
> Rainer Dorsch
> http://bokomoko.de/


Hi,

Not sure what you are exactly trying to accomplish and you may need
to explain further.

If you want to basic string compare:

if [[ "abc" < "dec" ]]; then echo true; else echo false; fi

Regards

Phil

-- 
*** If this is a mailing list, I am subscribed, no need to CC me.***

Playing the game for the games sake.

Web: https://kathenas.org

Twitter: kathenasorg

Instagram: kathenasorg

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: