With this bash script, I check the directory for *xls files, and if they are, I send them for conversion using ssconvert to *xlsx. All this works if there is only one file in the directory. If there are several or more in the directory, a "binary operator expected" error appears. Please help me fix my script.
#!/bin/bash
while true
do
test -f /home/doc/testy/*.xls && for f in /home/doc/testy/*.xls; do ssconvert "$f" "${f%.xls}.xlsx";
chown www-data:www-data "${f%.xls}.xlsx";
rm -f -- "$f"; done
sleep 10
done