Shellscript syntax question

Dan Nelson dnelson at allantgroup.com
Mon Jan 9 11:54:42 PST 2006


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.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list