Jebathon
Jebathon

Reputation: 4561

Unix - Using strong quotes with GREP

Long list all text files within command line that have permissions accessible to you.

  ls -l /home *txt* | grep '^-rwx'

Would be the appropriate command. Now my question is:

Why use strong quotes for grep - wouldn't that render useless the "^" within '^-rwx'? From my understanding strong quotes remove the functions all meta-characters.

Also why use ^?

Upvotes: 0

Views: 294

Answers (1)

Marc B
Marc B

Reputation: 360632

The quotes are there to prevent the SHELL from interpreting any metacharacters. The quotes will not be passed on to grep. Grep will see ^-rwx as the argument, not '^-rwx'.

Upvotes: 2

Related Questions