Project101.Have Fun


Project 101. Have Fun

"Know any good jokes?"

This project shows some amusing responses from Bash and Tcsh, and tells you how to cheat at crosswords.

Bash Humor

Type the following commands exactly as given.

$ %earn-easy-money -bash: fg: %earn-easy-money: no such job $ man woman No manual entry for woman $ awk 'The ship is leaking:' awk: syntax error at source line 1   context is          The ship is >>> leaking: <<< awk: bailing out at source line 1


Create a trick file to confuse your (less clever) colleagues. Call the file README, and make its contents that of the error message reported when the same file does not exist.

$ echo "cat: README: No such file or directory" > README


Prove that the file exists.

$ ls -l README -rw-r--r-- 1 saruman saruman 39 Oct 14 19:45 README


Show that it (apparently) cannot be found by the cat command.

$ cat README cat: README: No such file or directory $


Q. How do you pronounce "1000 000 000 000 000 000 000"?

A. Type

$ say "1000000000000000000000"


And, even sillier,

$ say -v "Bad News" "777777777777777777777777777777"


Tip

Do you know that "eleven plus two" is a mathematically correct anagram for "twelve plus one"?


Tcsh Humor

If you're running the Bash shell, start a Tcsh shell to run these examples by typing

$ tcsh %


Type the following commands exactly as given.

% "How good looking am I? tcsh: Unmatched ". % Got a light? tcsh: Got: No match. % ^^How did the sex change operation go? tcsh: Modifier failed. % man: Why did you get a divorce? tcsh: man:: Too many arguments.


Cheat at Crosswords

Take advantage of the grep command, regular expressions, and the dictionary that's supplied with a standard Mac OS X install. The dictionary is in the directory /usr/share/dict/. Read the README file for more information (it's not a trick README ).

$ ls /usr/share/dict/ README connectives propernames web2 web2a words


To search for all the words that match "b blank blank b blank blank z blank blank," type

$ grep "^b..b..z..$" /usr/share/dict/web2 bamboozle


Learn More

Refer to Project 23 for more information on the grep command and Project 77 to learn regular expressions.


If several words match the pattern, and you don't know the meaning of them all, look up a meaning by using an online dictionary and the curl command.

$ curl dict://dict.org/d:bamboozle 220 aspen.miranda.org dictd 1.9.15/rf on Linux 2.4.27... ... Bamboozle \Bam*boo"zle\ (b[a^]m*b[=oo]"z'l), v. t. [imp.  {Bamboozled} (b[a^]m*b[=oo]"z'ld); p. pr. & vb. n.  {Bamboozling} (b[a^]m*b[=oo]"zl[i^]ng).]  [Said to be of Gipsy origin.]  To deceive by trickery; to cajole by confusing the senses;  to hoax; to mystify; to humbug. [Colloq.] --Addison.


Learn More

Project 95 covers the curl command in detail.


Trivial Pursuits

Other useful directories are at /usr/share. Many calendars, including U.S. holidays and computer-related dates, are there for the grepping.

When are the spring and autumn equinoxes?

$ grep -sh "Equinox" /usr/share/calendar/calendar.usholiday 03/20* Vernal Equinox 09/22* Autumnal Equinox


When was Apple Computer founded?

$ grep -swh "Apple" /usr/share/calendar/calendar.* 01/03 Apple Computer founded, 1977 06/10 First Apple II shipped, 1977


When was Sir Paul McCartney born?

$ grep -sh "Paul McCartney" /usr/share/calendar/calendar.* ¬     | grep born 06/18 Paul McCartney born in Liverpool, England, 1942





Mac OS X UNIX 101 Byte-Sized Projects
Mac OS X Unix 101 Byte-Sized Projects
ISBN: 0321374118
EAN: 2147483647
Year: 2003
Pages: 153
Authors: Adrian Mayo

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net