When I do something like this:
grep "hello" /home/paul/*
But when I do something like this:
grep "hello" "/home/paul/*"
grep display the error:
grep: /home/paul/*: No such file or sirectory
Why is that?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
From the bash reference manual:
Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.
So you must remove the special character
* from your quoted string in order for it to be treated as a wildcard.
grep "hello" "/home/paul/"*