It searches /tmp/list.
grep options, from man grep:
Quote:
-l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output
would normally have been printed. The scanning will stop on the first match. (-l
is specified by POSIX.)
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input files. (-i is specified
by POSIX.)
-s, --no-messages
Suppress error messages about nonexistent or unreadable files. Portability note:
unlike GNU grep, 7th Edition Unix grep did not conform to POSIX, because it lacked
-q and its -s option behaved like GNU grep’s -q option. USG-style grep also lacked
-q but its -s option behaved like GNU grep. Portable shell scripts should avoid
both -q and -s and should redirect standard and error output to /dev/null instead.
(-s is specified by POSIX.)
|
Now the regular expression:
- Beginning of line (^)
- Anything but a space ([^ ]) zero or more times (*)
- A colon
- A space
- Any character, zero or more times (.*)
- $arg, in this case, "testserver"
So it searches /tmp/list for lines that start with some non-space characters followed by a colon, then a space then anything until the word "testserver". If there's a match it will print "/tmp/list".
A good regex resource:
http://www.regular-expressions.info