I have a question after reading about extended glob.
shopt -s extglob,
What is the difference in the following?
?(list): Matches zero or one occurrence of the given patterns. *(list): Matches zero or more occurrences of the given patterns. +(list): Matches one or more occurrences of the given patterns. @(list): Matches one of the given patterns.
Yes, I have read the above description that accompanies them, but for practical purpose, I can't see situations where people would prefer ?(list) over *(list). That is, I don't see any difference.
I've tried the following:
$ ls > test1.in test2.in test1.out test2.out` $ echo *(*.in) > test1.in test2.in $ echo ?(*.in) > test1.in test2.in
$ echo ?(*.in) to output
test1.in only, from the description, but it does not appear to be the case. Thus, could anyone give an example where it makes a difference regarding the type of extended glob used?