delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
From: | ericblake AT comcast DOT net (Eric Blake) |
To: | "Williams, Gerald S (Jerry)" <gsw AT agere DOT com>, cygwin AT cygwin DOT com |
Cc: | Alireza Ghasemi <fooladgh AT gmail DOT com> |
Subject: | RE: syntax highlighting in vim |
Date: | Wed, 23 Nov 2005 16:21:01 +0000 |
Message-Id: | <112320051621.13317.438496EC000DB0B50000340522070208530A050E040D0C079D0A@comcast.net> |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
> > The use of a trailing space in the alias controls > > whether the next word on the command line will also > > be subject to alias expansion; > > True, but I prefer not to make assumptions about how > people are using aliases. The space at the end of the > alias makes it behave like the unaliased ls in that > regard. Wrong again - alias expansion in bash starts ONLY at the first word, and only progresses on to the next word if the current alias expansion ended in a space. So if ls is not aliased, the second word is never even checked for alias expansion. Therefore, putting a space at the end of an alias for ls actually maked ls behave DIFFERENTLY than the unaliased version, since it is now telling bash to alias expand the next argument. $ cd /tmp $ touch file $ alias ls bash: alias: ls: not found $ alias file=oops $ ls file file $ alias ls='ls ' $ ls file ls: oops: No such file or directory $ \ls file file Furthermore, in 99.9% of the cases, a shell function can do the same thing as an alias. $ unalias ls $ ls() { command ls --color=auto "$@" } $ The exceptional cases are when you do funky things like those mentioned in http://www.chiark.greenend.org.uk/~sgtatham/aliases.html. I kind of like this hack that makes find temporarily supress globbing, so that I can type "find -name *.c" instead of "find -name '*.c'": alias find='_find() { command find "$@"; set +f; }; set -f; _find' -- Eric Blake volunteer cygwin bash maintainer -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |