My find is not working the way I expected. When there is more than one file it halts with error.
hpek@melda:~/temp/test$ ll
total 16
-rw-r--r-- 1 hpek staff 70B Mar 2 15:16 f1.tex
-rw-r--r-- 1 hpek staff 70B Mar 2 15:17 f2.tex
hpek@melda:~/temp/test$ find . -name *.tex
find: f2.tex: unknown option
hpek@melda:
and if I remove one of the files, then it works:
hpek@melda:~/temp/test$ rm f1.tex
hpek@melda:~/temp/test$ find . -name *.tex
./f2.tex
hpek@melda:~/temp/test$
It does not matter what file I remove. As soon as the wildcard gives more than one file, then find halts.
*.texis expanded by bash before sent as argument to the command.is in your case equivalent to
Solution: Put
"..."around arguments with wildcards to avoid the shell expansion:This will work as expected: