July 2007
Beginner
347 pages
4h 40m
English
The test command allows you to conditionally perform some task based on the existence, type, or status of a file. It also lets you do the same thing by comparing integer and string values. For my sake, we’ll keep it as simple as possible and stick to file tests while still showing off some of its potential.
OK. You’re not using AOL, but you want to know when you get mail. We can check for mail with the test command. Granted, a beep is not quite as nice as a human voice announcement, but it’s fine for our purposes.
The command below tests for the existence of /var/mail/username (that’s what the -e argument does) AND sounds a beep if it is found. At least it does if the beep program is installed ...
Read now
Unlock full access