[rhn-users] unary operator expected ??

Alfred Hovdestad alfred.hovdestad at usask.ca
Tue Apr 19 14:46:56 UTC 2005


Hi:

I don't think ls returns a true value.  You will probably have to check 
for the existence of a specific file name or pipe the output of ls 
through wc to get a numeric value.

numfiles=`ls /home/bc_bigfiles/pub | wc -l`
if [ $numfiles -gt 0 ]; then echo "Files found in server `hostname`"; fi


    Alfred Hovdestad
    University of Saskatchewan


FM wrote:
> Hello my crontab is :
> 
> if [ `ls /home/bc_bigfiles/pub` ]; then echo "Files found in server 
> `hostname`"; fi ;
> 
> in the folder pub :
> NBCA_20050418_1.zip  NBQB_20050418_2.zip
> 
> Now I received ths error :
> NBCA_20050418_1.zip: unary operator expected
> 
> What does iy mean ? On the web I found some pages talking about unset 
> variable, which it is not my case, I have none :-)
> 
> Thanks !
> 
> _______________________________________________
> rhn-users mailing list
> rhn-users at redhat.com
> https://www.redhat.com/mailman/listinfo/rhn-users




More information about the rhn-users mailing list