OK. We have a long way to go.
I agree with a lot of what Aia said, but will expand on a couple of things later...
First, never try to learn how to use a UNIX or Linux system from a book without having an active account on a system and a keyboard and display device where you can interactively type in commands and see the results immediately. And, until you are much more experienced AND are actually trying to perform system administration duties, use a normal user account (not root) to play around. (When you are running as root, you can do some serious damage to the system; when you are running as a normal user, you might screw up some of your files but you won't hurt the system nor any other users.) But when you're playing with things like
grep, there is VERY little chance that you'll hurt anything.
Quote:
In this case, by conversion the interpretation means:
I think Aia meant
convention instead of
conversion.
Quote:
'/home/[Aa-Zz]*' : BRE (Basic Regular Expression) pattern, it is surrounded by single quotes to tell the shell not to try to interpreted the content and passed to grep as it.
[Aa-Zz] : Character class; The A and lower z are redundant since the range a-Z converts them. [a-Z] does the same.
When used in a
grep command in this position,
/home/[Aa-Zz]* is a BRE, but:
[Aa-Zz] is a RE matching expression; not a character class. And the matching expression matches a single character that is
A, a character in the inclusive range of characters starting with
a and ending with
Z, and the character
z. But the range expression
a-Z is only defined if
a comes before
Z in the collating sequence in the the current locale. In the C and POSIX locales (and in most locales available on UNIX and Linux systems,
Z comes before
a. On some systems the end points will be reversed and it will match the characters in the string
Z[\]^_`a and in other systems, it will be rejected producing a diagnostic message from
grep saying that the BRE
/home/[Aa-Zz]* is invalid.
If you're trying to match a string of alphabetic characters in the current locale, An RE matching expression containing a character class expression that would do that is
[[:alpha:]]. In the C and POSIX locales, the RE matching expression
[A-Za-z] would match the same list of characters. But in locales with other alphabetic characters (such as accented vowels in Spanish locales, Cyrillic characters in Russian locales, etc.), these expressions might match very different sets of characters.
Quote:
/etc/passwd/home/deerlet : path of the file that grep will read, in order to try to find lines that match the pattern previously mentioned.
On UNIX and Linux systems,
/etc/passwd is the name of a regular file containing what is frequently called the
user database. Since it is a regular file, the pathname
/etc/passwd/home/deerlet will yield an ENOTDIR error while trying to resolve that pathname and
grep (if it didn't abort with a bad BRE error) will issue a diagnostic saying it can't open that file and quit.