[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 808ercise: Shell Golf
Bzzzzzzzzzt.
Weiqi tried and failed (sorry about the line wrap):
> echo "for x in *;do file \$x|grep -q script&&[ -x \$x ]&&grep -H \
> that\ pays \$x;done"|sh
>
> 88!
> On Fri, 2003-04-18 at 15:15, mike808@users.sourceforge.net wrote:
> > A solution is disqualified if a test case can demonstrate any of:
> > 1. The command produces any output other than the matching grep output.
> > 2. Performs grep searches of any file other than script files.
> > 3. Does not perform a grep search of all script files.
> > 4. Does not locate an instance of the phrase 'that pays' in a script file.
Your solution will fail for a binary executable containing the phrase that
just happens to be named 'this is not a script'.(#2)
Your solution may also fail for files containing spaces in their names.(#1,#2)
Very close, though.
After two more worthy attempts, I'll post my solution.
Mike808/
---------------------------------------------
http://www.valuenet.net
-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.