zsh-users
 help / color / mirror / code / Atom feed
* Defining commands to not evaluate certain metacharacters
@ 2003-12-20 18:39 Lloyd Zusman
  2003-12-21  1:32 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Lloyd Zusman @ 2003-12-20 18:39 UTC (permalink / raw)
  To: zsh-users

I want to define a set of commands that I can execute from the command
line under zsh.  These commands will be performing certain mathematical
operations on their arguments, and therefore, I would like parentheses
and possibly also square brackets to be passed to the command unchanged
by the shell.  However, I want to be able to use variable expansion.

I would like to do this without quoting these parentheses (or square
brackets, if I use them).  For example, if CMD is one of the commands
that I define and OP1, OP2, and OP3 are operations that CMD understands,
I would like the following to take place:

  a=3
  b=4
  CMD (($a OP1 1) OP2 ($b OP3 2))

  means:  expand $a and $b on the command line, so that the
          intermediate result is this:

            CMD ((3 OP1 1) OP2 (4 OP3 2))

          then, pass the string '((3 OP1 1) OP2 (4 OP3 2))' as the
          command line to CMD, which then interprets it as it pleases.

I know that I can achieve this result by double-quoting the command
line, as follows:

  CMD "(($a OP1 1) OP2 ($b OP3 2))"

However, as I mentioned above, my goal is to avoid using quotes.

Is there any way to set up aliases or something similar under zsh so
that I can define commands that will function like my CMD example?

Thanks in advance.

-- 
 Lloyd Zusman
 ljz@asfast.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-12-22  4:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-20 18:39 Defining commands to not evaluate certain metacharacters Lloyd Zusman
2003-12-21  1:32 ` Bart Schaefer
2003-12-21  1:38   ` Philippe Troin
2003-12-21  6:53     ` Bart Schaefer
2003-12-22  4:29       ` Philippe Troin

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).