> On 10 Mar 2018, at 08:26, tu...@posteo.de wrote: > ... > > As soon the file is not found, the script ends with an 'Not found' > error, which '-f' is exactly for, because the expanding comes before > the '-f'... > > So I need something else or a try-catch-thingy to make that work...but > how? > > Or do I miss the forest for the trees here... ;)
I don't get that at all with this snippet: $ cat test.sh #!/bin/bash if [ -f foo* ] ; then echo "foo exists" fi $ This makes me suspect you've got `#!bash -x` (or -e?) as your first line, or something. When you encounter a problem you don't understand, create the most minimal program you can to reproduce the problem. If you can't reproduce it, add to it one step at a time until it becomes what you're trying to do. Stroller