I want to
The following will not work if there are any pdf files because then the first compgen
will return true
and the second compgen
will not be executed.
{ compgen -G "*.pdf" || compgen -G "*.txt"; }
Is there a way to prevent short-circuiting?
Using ; would just return the result of the last compgen. I still need the logical or of all the compgens to know if there was any match.
You can write logic to handle exit status yourself. A short version could look likethe following:
{ cmd1; ret=$?; cmd2; ! ((ret | $?)); }