From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Paul Lew <lew@ezdzit.zko.dec.com>, zsh-users@math.gatech.edu
Subject: Re: delay argument interpretation
Date: Mon, 21 Jul 1997 11:52:58 -0700 [thread overview]
Message-ID: <970721115258.ZM10155@candle.brasslantern.com> (raw)
In-Reply-To: <9707211605.AA17539@ezdzit.zko.dec.com>
On Jul 21, 12:05pm, Paul Lew wrote:
} Subject: delay argument interpretation
}
} This all work out nice, however, the comment blocks in these files are
} different and I would like to apply a filter (rmcmt in the example
} below) to it so I will only see the source differences:
}
} for i in *.c; do
} ask diff =(rmcmt old/$i) =(rmcmt $i)
} done
The obvious solution to this specific problem is to use "diff -I <re>" to
ignore lines matching the regular expression <re>.
The other solution that occurs to me is
function diffsrc() {
local x=$[$#-2]
diff $*[1,$x] =(rmcmt $*[$x+1]) =(rmcmt $*[$x+2])
}
for i in *.c; do ask diffsrc old/$i $i; done
} What can I do to quote the arguments so it will not expand until
} later in function ask?
Something like what Zefram suggested is the only way; really do quote them
yourself. In csh I'd use an alias with \!: expansions like this:
alias ask 'echo -n \!*:q"? [y/n] "; askify \!*'
(and then "askify" would be a script that does everything but the echo in
your "ask"). But zsh doesn't have such a mechanism for re-quoting the
command line at alias time, before any of it gets expanded. The closest
you can get is somthing like
alias ask='noglob ask'
which delays filename expansion but not command name substitution et. al.
I have this little function:
show () {
show=()
show=($~*)
print -rc $show
}
alias show='noglob show'
which allows me to do things like
show **/*.{orig,rej}
(examine what I see for a bit, then do something else like)
rm $show
(which avoids doing the recursive glob twice).
My only complaint about this is that completion for "noglob" gets invoked
if I happen to press TAB, rather than completion for "show". I think
that's a bug.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
next prev parent reply other threads:[~1997-07-21 19:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-07-21 16:05 Paul Lew
1997-07-21 16:43 ` Andrew Main
1997-07-21 18:52 ` Bart Schaefer [this message]
1997-07-22 8:23 ` Andrew Main
1997-07-22 16:10 ` Bart Schaefer
1997-07-22 17:25 ` Zoltan T. Hidvegi
1997-07-22 17:28 Zoltan T. Hidvegi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=970721115258.ZM10155@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=lew@ezdzit.zko.dec.com \
--cc=zsh-users@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).