Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 2006 14:32:13 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Frank Staals <frankstaals@gmx.net>
Cc:        questions@freebsd.org
Subject:   Re: Shellscript syntax question
Message-ID:  <20060109203212.GD89638@dan.emsphone.com>
In-Reply-To: <43C2C59A.6020906@gmx.net>
References:  <43C2BE4A.4070601@gmx.net> <20060109195427.GC89638@dan.emsphone.com> <43C2C59A.6020906@gmx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jan 09), Frank Staals said:
> Dan Nelson wrote:
> >In the last episode (Jan 09), Frank Staals said:
> >
> >>I'm trying to write a ( simple ) shellscript to move files arround,
> >>for this reason I wanted to check wether 'episode_last' has a
> >>higher value than 'episode_first' ( so that last can't be 3 if
> >>first is 60). So I tried :
> >>
> >>*if** [* ${episode_last} < ${episode_first}* ]*; *then
> >>	<code>
> >>fi
> >>
> >>*As I thought what would have been the correct syntax, but I got this 
> >>error when running the script : 
> >>./massmove: line 136: 05: No such file or directory
> >>
> >>
> >>'05' was the value of $episode_first and '01' was the value of 
> >>$episode_last 
> >
> >You want "-lt" not "<".  "<" is a file redirect, which is why the
> >shell complained that it couldn't find a file named "05".  I also
> >assume all those asterisks aren't in your script.
>
> About the asteriks : No they weren't but for some reason Thunderbird
> had problems with the color remaining from the KATE
> Syntax-hilighting.  Anyway: thanks for the solusion, but what would
> be the expressions for ">" "less or equal" and "greater or equal" ?

See the "test" manpage.  -gt, -le, -ge.  

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060109203212.GD89638>