[SlugBug] shell script help

Bruno Postle bruno at postle.net
Thu Aug 7 13:08:18 BST 2003


On Thu 07-Aug-2003 at 11:52:32AM +0100, Bill Best wrote:
> 
> Many thanks for this, Daniel.  Before running this script, I amended it 
> just to check it, so it now looks like:
> 
> for FILE in $(ls directory1/*); do
>  for FILE2 in $(ls directory2/*); do
>    if [ $(cmp $FILE $FILE2) -eq 0 ]; then            #problem here
>       echo $FILE $FILE2
>    fi
>  done
> done
> 
> but it bombs out with:
>                                         [: too many arguments
> for the line indicated above.
> 
> Anyone got any ideas?

The output of ls can vary on different systems, try restricting it
to one filename per line:

   ls -1 --color=never

-- 
Bruno


More information about the SlugBug mailing list