Argument-swap feature within csh
utzoo!decvax!microsof!fluke!jeff
utzoo!decvax!microsof!fluke!jeff
Thu Apr 14 22:44:09 AEST 1983
I kinda like this one.
Here's a fun test for your next prospective job candidate...
Ask her what the following csh script does. Just for fun, ask yourself, too.
#! /bin/csh -f
set noglob
echo '1' >/tmp/foo
echo `/bin/cat /tmp/foo` -2 3
STOP. Do not turn the page until you have the answer.
===============================================================================
In case you don't have a 4.1BSD UNIX system, I'll reproduce the output below:
% bug
-2 1 3
%
Did you get that? Good.
Now explain the following:
- Suppose you were to comment out the "set noglob" statement. Why
does this swap the first two arguments?
- Suppose you change the second argument from "-2" to "2".
Why does this...?
You have 30 minutes to complete this exercise. If you find the answer, would
you kindly let me know?
Jeff Stearns ...!decvax!microsoft!fluke!jeff
John Fluke Mfg. Co., Everett WA. (206) 356-5064
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list