user425727
user425727

Reputation:

shell wildcards

i tried to google this but can't find a satisfactory answer. it's probably very straightforward so apologies if it's basic stuff

what is the difference bewteen

grep "first" */*html

and

 grep "first" ./*html

i know that dot(.) in the second line stands for 'current directory'

Upvotes: 1

Views: 301

Answers (2)

shellter
shellter

Reputation: 37318

grep "first" */*html

expands as all html files in all subdirectories (one-level only) from the current dir.

grep "first" ./*html

expands as all html files in the current dir. the './' is what limits it the the current dir.

EDIT

Per @lisko 's comment

Hidden files and directories mean files beginning with the '.' character. If you want to search ALL files, use

grep "first" ./*html ./.*html */*html */.*html

I hope this helps.

Upvotes: 4

likso
likso

Reputation: 3440

The first line will grep through all files that match filenames ending with "html" one directory below the current directory because the first "*" will match any directory.

The second line will grep though all the files that match filenames ending with "html" in the current directory.

Note that hidden files or hidden directories won't be matched.

Upvotes: 3

Related Questions