From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from math.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with SMTP id NAA10664 for ; Thu, 9 Nov 1995 13:33:46 +1100 (EST) Received: by math.gatech.edu (5.x/SMI-SVR4) id AA28537; Wed, 8 Nov 1995 21:12:17 -0500 Resent-Date: Thu, 9 Nov 1995 02:12:35 +0000 (GMT) Old-Return-Path: From: Zefram Message-Id: <19823.199511090212@stone.dcs.warwick.ac.uk> Subject: Re: Rationalized? aliases To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Thu, 9 Nov 1995 02:12:35 +0000 (GMT) In-Reply-To: <199511082317.SAA29367@redwood.skiles.gatech.edu> from "Richard Coleman" at Nov 8, 95 06:17:19 pm X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]6565.46 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-Id: <"KCJxZ2.0.mz6.0EMem"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/578 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu >Hmm... A quick fix for your problem is to change >printaliasnode() in hashtable.c so that when the flags >PRINT_WHENCE_* are present, that it will use printf (or puts) >instead of printquoted(). This is exactly how it was done in >beta10. But is this what we want to do? It looks natural for >the output of `type' and `which' to be quoted. For `whence' it >is not quite so clear which is best. "whence" is supposed to be used by humans. Its output should be quoted. Putting it in a command substitution is, and always was, a kludge. That's what equals substitution is for: % alias foo=bar % echo =foo bar but there is an inconsistency, in a way, between equals substitution of normal commands and of aliases: % whence 'a*b' /dcs/94/zefram/bin/a*b % echo ='a*b' /dcs/94/zefram/bin/a*b % ='a*b' This is a script with a silly name. % alias foobar='echo *' % echo =foobar echo * % =foobar zsh: command not found: echo * Actually the inconsistency is not in the equals substitution itself, but in the fact that the text it expands to will, in actual use, be rescanned. This limits the use of equals substitution a little. I think for builtins and shell functions equals substitution should expand to the command name, rather than its present behaviour of failing. Then equals substitution will be usable in functions in an interesting way: function foo { local savecmd==$1 evalhack= alias $1 >&- && evalhack=eval # some commands that mess up PATH or whatever $=evalhack $savecmd some args # more commands } Maybe there should be another syntax similar to equals substitution -- say, ==command -- that puts an extra layer of quoting on the substituted filename unless the command is an alias. That would make the above function: function foo { local savecmd===$1 evalhack= # some commands that mess up PATH or whatever alias savedcmd=$savecmd savedcmd some args # more commands } Anyone got any better ideas? -zefram