Search code examples
linuxglob

Execution of ls command in Linux


I don't understand the execution when ?? and * are used together.

The following files are in the current working directory:

abc.txt
abcd.txt
bcd.txt
amm.doc
ammc.txt

What is the return result after executing command ls a??.*


Solution

  •  * Matches any string, including the null string (empty string)
     ? Matches any single character
    

    For exemples

     Pattern a??.* matches abc.txt  
    

    - (a,a)
    - (?,b)
    - (?,c)
    - (.,.)
    - (*,txt)

     Pattern a??.* don't matches abcd.txt
    

    - (a,a)
    - (?,b)
    - (?,c)
    - but . dont' matches with d

    Pattern a??.* don't matches bcd.txt because a don't matches with b.