bash - “unary operator expected” in shell script -


i need script keep polling "receive_dir" directory till "stopfile" written in directory.

this has run despite empty directory.

so far have fails if receive_dir empty no files "unary operator expected". !!

#!/usr/bin/ksh  until [ $i = stopfile ]     in `ls receive_dir`;    time=$(date +%m-%d-%y-%h:%m:%s)    echo $time    echo $i;   done done 

this ask (loop until stop file exist). added "sleep 1" lower resource usage. it's practice use "#!/usr/bin/env ksh" shebang.

#!/usr/bin/env ksh  until [ -e receive_dir/stopfile ]     time=$(date +%m-%d-%y-%h:%m:%s)    echo $time    sleep 1 done 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -