Bash for loop with wildcards and hidden files?

FILES=". Bash works because the hidden files name begin with a.

FILES=". Bash*" works because the hidden files name begin with a . FILES="bash*" doesn't work because the hidden files name begin with a .

Not a be FILES="*bash*" doesn't work because the * wildcard at the beginning of a string omits hidden files.

So if I want to do it I should do FILES=". *bash*"? But what if I want hidden AND not hidden files?

– sixtyfootersdude Jan 25 '10 at 21:42.

The default globbing in bash does not include filenames starting with a . (aka hidden files). You can change that with shopt -s dotglob 22:38:07 0 ~/foo $ ls -a ... .

A . B . C d e f 22:38:11 0 ~/foo $ ls * d e f 22:38:12 0 ~/foo $ shopt -s dotglob 22:38:18 0 ~/foo $ ls * .

A . B . C d e f 22:38:20 0 ~/foo $ To disable it again, run shopt -u dotglob.

Yes, the . At the front is special, and normally won't be matched by a * wildcard, as documented in the bash man page (and common to most Unix shells): When a pattern is used for pathname expansion, the character “. ” at the start of a name or immediately following a slash must be matched explicitly, unless the shell option dotglob is set.

When matching a pathname, the slash character must always be matched explicitly. In other cases, the “. ” character is not treated specially.

OP if you want hidden and non hidden, set dotglob (bash) #! /bin/bash shopt -s dotglob for file in * do echo "$file" done.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions