Subject: Re: Rather useful unix utility
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 31 Jul 2005 01:27:39 -0500
Newsgroups: comp.lang.lisp
Message-ID: <guqdnSRQ7pnG8nHfRVn-jQ@speakeasy.net>
William Bland  <news456@abstractnonsense.com> wrote:
+---------------
| http://abstractnonsense.org/cgi-bin/trac.cgi/wiki/ClUtils
...
| wjb@bills-laptop ~ $ cl:+ 1 2 3
| 6
+---------------

I have something similar, a wrapper script I use to run CMUCL.
When given command-line arguments it instead treats it as just a
single sexpr to REP (no L).

    % cmu + 1 2 3
    6
    % 

But for some reason [terminal cuteness?] I also have it symlinked
from ~/bin/= (yes, a bare "=" is a legal Unix file name), so what
I usually type is more like this [and, yes, as you've noticed, when
trying to enter sub-exprs the shell quoting can rapidly become an
*enormous* pain]:

    % = + 1 2 3
    6
    % = expt 2 100
    1267650600228229401496703205376
    % = mapcar "(lambda (x) (* x x))" "(iota 5)"
    (0 1 4 9 16)
    % = values "(* 2 4)" "(+ 1 5)"
    8
    6
    % = - 0x47fea 0x47fdc
    14
    %

[Oh, yeah, there's a "0" reader macro that gets turned on in that case,
so I can cut'n'paste numbers from hardware debugging sessions. Doing "0x"
numbers was easy; *not* messing up "0.123" was much harder; and I gave up
on not botching symbols whose names start with "0" (oops).]

+---------------
| wjb@bills-laptop ~ $ # How big are outbound TCP buffers?
| wjb@bills-laptop ~ $ netstat -n | grep tcp | awk '{print $3}' | cl:+
| 162
+---------------

But in the case, why not just type this??  ;-}  ;-}

    % netstat -n | grep tcp | awk '{sum += $3 } END {print $3}'
    47
    % 


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607