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

Re: Bash Question



Hi,

On Wed, Jul 5, 2017 at 11:12 PM, Rainer Dorsch <ml@bokomoko.de> 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?

You need to scape "<" and ">":

if [ "abc" \> "dec" ] ; then ... ;fi
if [ "abc" '>' "dec" ]; then ... ; fi
if [ "abc" ">" "dec" ]; then ... ; fi


Delete "dec" file, ( ">" is redirection in bash, so you was creating that file

Regards


Reply to: