From locate man page:
If --regex is not specified, PATTERNs can contain globbing characters. If any PATTERN contains no globbing characters, locate behaves as if the pattern were *PATTERN*.
Now, see the output from these commands:
test@ubuntu:~$ ls
Desktop Documents Downloads Firefox_wallpaper.png Music Pictures Public Templates Videos
test@ubuntu:~$
test@ubuntu:~$
test@ubuntu:~$ locate '/bin/bash*'
test@ubuntu:~$
test@ubuntu:~$
test@ubuntu:~$ locate /bin/bash*
/snap/core18/1880/bin/bash
/snap/core18/1880/usr/bin/bashbug
/snap/core18/1944/bin/bash
/snap/core18/1944/usr/bin/bashbug
/usr/bin/bash
/usr/bin/bashbug
If you see my present working directory have no file/directory whose full path name begins with /bin/bash. Hence, we should not be receiving any output from locate /bin/bash*. Why ?
According to globbing feature of shell , since I have no such file/directory in my current working directory, hence, the * will be not be expanded and passed as it is. Hence, it should be equivalent to using locate '/bin/bash*'(which is our 2nd command run above). Since, this does not receive any output, hence this locate /bin/bash* should not also give output ?