匹配隱藏檔案
製備
$ mkdir globbing
$ cd globbing
$ mkdir -p folder/{sub,another}folder/content/deepfolder/
touch macy stacy tracy "file with space" folder/{sub,another}folder/content/deepfolder/file .hiddenfile
$ shopt -u nullglob
$ shopt -u failglob
$ shopt -u dotglob
$ shopt -u nocaseglob
$ shopt -u extglob
$ shopt -u globstar
Bash 內建選項 dotglob 允許匹配隱藏檔案和資料夾,即以 .
開頭的檔案和資料夾
$ shopt -s dotglob
$ echo *
file with space folder .hiddenfile macy stacy tracy