zsh-users
 help / color / mirror / code / Atom feed
From: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>
To: zsh-users@sunsite.auc.dk
Subject: Re: setopt and alias questions
Date: Sun, 7 Feb 1999 23:52:14 -0500	[thread overview]
Message-ID: <19990207235214.A2653@astaroth.nit.gwu.edu> (raw)

On Sun, Feb 07, 1999 at 05:59:31PM -0800, Bart Schaefer wrote:
> Please stop using <zsh-users@math.gatech.edu>.  The mailing list address is
> now <zsh-users@sunsite.auc.dk>.  Forwarding through the old address won't
> work forever.  Your Mail-Followup-To: header should be fixed, too.
	oops.  i never noticed that i was using the old address.

> On Feb 7,  7:37pm, Sweth Chandramouli wrote:
> } 	1) is there some way to force setopt to list the status
> } of all options?
> 
> Yes:  setopt kshoptionprint
> 
> However, this produces all sorts of lovely double-negatives like
> 
> noalwayslastprompt    off
> noautolist            off
> noautomenu            off
> nolistambiguous       off
> nolistbeep            off
> nolisttypes           off
	
	here's the workaround i just came up with; it depends on the
fact that the options that already start with "no" (e.g. notify) are,
by default, on.  it probably needs a test at the beginning to see
what the current value of kshoptionprint is, but since i won't ever
be setting that option manually now that i have this function, i
didn't bother to put it in.

allopt () {
   builtin setopt kshoptionprint
   for OPT_PAIR in ${(f)$(builtin setopt)} ; do
      OPT_VALUE=$((${#${(M)OPT_PAIR% *}}%2))
      OPT_NAME=${OPT_PAIR% *}
      if [[ ${OPT_NAME#no} != ${OPT_NAME} ]] ; then
         OPT_VALUE=$(( (${OPT_VALUE}+1)%2 )) &&
            OPT_NAME=${OPT_NAME#no};
      fi;
      if [[ ${OPT_VALUE} = 1 ]] ; then
         OPT_VALUE='on'
      else OPT_VALUE='off'
      fi;
      echo ${(r:28:)OPT_NAME} ${OPT_VALUE}
   done
   builtin unsetopt kshoptionprint
}

> } 	2) does zsh not support tracking or exporting of aliases?
> 
> Zsh does not export aliases.  
	so aliases to be present in all interactive shells must be
defined in .zshrc?  aside from global aliases, is there any reason
to not put all of my aliases into equivalent functions?  (other than
memory use, of course.)

> I don't know what you mean by "tracking."
	ksh tracks aliases (it used to be an option to the alias command,
but now i believe it is mandatory) as a security/efficiency aid.  tracking
means that when an alias is first invoked, its definition is modified as
though all commands it calls were defined with their full paths.  this
speeds things up a little because all subsequent invocations of that
alias don't have to find the commands in PATH, and is a bit more secure
in that it can be used, by aliasing commands like ls, to help prevent 
problems caused by insecure paths--once a command that has been "wrapped"
by its alias has been invoked, subsequent invocations will refer back
to that original command, as opposed to, say, an evil trojan in the current
directory that would otherwise have been run by a PATH containing ".".

	-- sweth.

-- 
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


         reply	other threads:[~1999-02-08  4:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-08  0:37 Sweth Chandramouli
1999-02-08  1:59 ` Bart Schaefer
1999-02-08  4:52   ` Sweth Chandramouli [this message]
1999-02-08  7:33     ` Bart Schaefer
1999-02-08 15:30       ` Sweth Chandramouli
1999-02-08 18:45         ` Bart Schaefer
1999-02-08 19:15           ` Sweth Chandramouli
1999-02-08 19:44             ` Bart Schaefer
1999-02-08 19:59               ` Sweth Chandramouli
1999-02-08 20:55                 ` Bart Schaefer
1999-02-12 19:34                   ` Sweth Chandramouli
1999-02-12 20:13                     ` Bart Schaefer
1999-02-08 19:46             ` Sweth Chandramouli
1999-02-08 20:30               ` Bart Schaefer
1999-02-09  8:40                 ` Phil Pennock

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=19990207235214.A2653@astaroth.nit.gwu.edu \
    --to=sweth@astaroth.nit.gwu.edu \
    --cc=zsh-users@sunsite.auc.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).