Shells like Bash and Zsh expand wildcard into arguments, as many arguments as match the pattern:$ echo *.txt1.txt 2.txt 3.txtBut what if I only want the first match to be returned, not all the matches?$ echo *.txt1.txtI don't mind shell-specific solutions, but I would like a solution that works with whitespace in filenames.
How can I get the first match from wildcard expansion?
shell;wildcards