zsh-users
 help / color / mirror / code / Atom feed
From: Lloyd Zusman <ljz@asfast.com>
To: zsh-users@sunsite.dk
Subject: Defining commands to not evaluate certain metacharacters
Date: Sat, 20 Dec 2003 13:39:10 -0500	[thread overview]
Message-ID: <m3y8t7jpv5.fsf@asfast.com> (raw)

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


             reply	other threads:[~2003-12-20 18:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-20 18:39 Lloyd Zusman [this message]
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

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=m3y8t7jpv5.fsf@asfast.com \
    --to=ljz@asfast.com \
    --cc=zsh-users@sunsite.dk \
    /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).