* few questions
@ 2001-11-21 9:29 Bruno Bonfils
2001-11-21 9:48 ` Max Ischenko
2001-11-21 16:07 ` Bart Schaefer
0 siblings, 2 replies; 12+ messages in thread
From: Bruno Bonfils @ 2001-11-21 9:29 UTC (permalink / raw)
To: Zsh-users List
[-- Attachment #1: Type: text/plain, Size: 256 bytes --]
Hi all,
it's possible to have alias like :
alias ls='ls --color'
alias 'ls -l'='ls -lh --color' <- doesn't work :(
Regards, Bruno
--
Bruno Bonfils
Admin sys GNU/Linux
http://www.oxianet.com/
http://www.domaine-action.com/
[-- Attachment #2: Type: application/pgp-signature, Size: 249 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 9:29 few questions Bruno Bonfils
@ 2001-11-21 9:48 ` Max Ischenko
2001-11-21 16:07 ` Bart Schaefer
1 sibling, 0 replies; 12+ messages in thread
From: Max Ischenko @ 2001-11-21 9:48 UTC (permalink / raw)
To: Bruno Bonfils; +Cc: Zsh-users List
Bruno Bonfils wrote:
> it's possible to have alias like :
>
> alias ls='ls --color'
> alias 'ls -l'='ls -lh --color' <- doesn't work :(
alias lh='ls -lh'
--
An experienced user learns to be pessimistic.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 9:29 few questions Bruno Bonfils
2001-11-21 9:48 ` Max Ischenko
@ 2001-11-21 16:07 ` Bart Schaefer
2001-11-21 16:15 ` Vincent Lefevre
1 sibling, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 2001-11-21 16:07 UTC (permalink / raw)
To: Bruno Bonfils, Zsh-users List
On Nov 21, 10:29am, Bruno Bonfils wrote:
}
} alias ls='ls --color'
} alias 'ls -l'='ls -lh --color' <- doesn't work :(
This is what shell functions are for.
function ls {
case "$1" in
-l) command ls --color -h "$@";;
*) command ls --color "$@";;
esac
}
Equivalently but more obscurely:
function ls {
[[ "$1" == -l ]] && 1=-lh
command ls --color "$@";
}
Be sure to remove your alias for `ls' if you're going to use a function.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 16:07 ` Bart Schaefer
@ 2001-11-21 16:15 ` Vincent Lefevre
2001-11-21 17:08 ` Zefram
2001-11-23 10:03 ` Giorgos Keramidas
0 siblings, 2 replies; 12+ messages in thread
From: Vincent Lefevre @ 2001-11-21 16:15 UTC (permalink / raw)
To: Zsh-users List
On Wed, Nov 21, 2001 at 16:07:52 +0000, Bart Schaefer wrote:
> On Nov 21, 10:29am, Bruno Bonfils wrote:
> }
> } alias ls='ls --color'
> } alias 'ls -l'='ls -lh --color' <- doesn't work :(
>
> This is what shell functions are for.
Well, this is a bit annoying as a function can't be avoided with "\".
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 16:15 ` Vincent Lefevre
@ 2001-11-21 17:08 ` Zefram
2001-11-21 17:22 ` Bart Schaefer
2001-11-23 10:03 ` Giorgos Keramidas
1 sibling, 1 reply; 12+ messages in thread
From: Zefram @ 2001-11-21 17:08 UTC (permalink / raw)
To: Zsh-users List
Vincent Lefevre wrote:
>Well, this is a bit annoying as a function can't be avoided with "\".
alias ls=fiddled_ls
function fiddled_ls { ...; }
-zefram
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 17:08 ` Zefram
@ 2001-11-21 17:22 ` Bart Schaefer
2001-11-21 17:28 ` Bart Schaefer
0 siblings, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 2001-11-21 17:22 UTC (permalink / raw)
To: Zsh-users List
On Nov 21, 5:08pm, Zefram wrote:
} Subject: Re: few questions
}
} Vincent Lefevre wrote:
} >Well, this is a bit annoying as a function can't be avoided with "\".
}
} alias ls=fiddled_ls
} function fiddled_ls { ...; }
Except that you should do that in the opposite order if you're planning
to make reference to `ls' in the body of `fiddled_ls'. See question 2.3
in the zsh FAQ.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 17:22 ` Bart Schaefer
@ 2001-11-21 17:28 ` Bart Schaefer
2001-11-21 17:51 ` Zefram
0 siblings, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 2001-11-21 17:28 UTC (permalink / raw)
To: Zsh-users List
On Nov 21, 5:08pm, Zefram wrote:
}
} Vincent Lefevre wrote:
} >Well, this is a bit annoying as a function can't be avoided with "\".
}
} alias ls=fiddled_ls
} function fiddled_ls { ...; }
Something just occurred to me:
alias '\ls'='command ls'
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 17:28 ` Bart Schaefer
@ 2001-11-21 17:51 ` Zefram
2001-11-21 18:01 ` Vincent Lefevre
2001-11-21 18:50 ` Bart Schaefer
0 siblings, 2 replies; 12+ messages in thread
From: Zefram @ 2001-11-21 17:51 UTC (permalink / raw)
To: zsh-users
Bart Schaefer wrote:
> alias '\ls'='command ls'
Or you could less confusingly alias ".ls" or something like that.
The ability to alias a particular pattern of quoting always seems to
me to lack any basis in theoretical sense or in practical utility;
like aliases in general, it is Bad and Wrong.
-zefram
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 17:51 ` Zefram
@ 2001-11-21 18:01 ` Vincent Lefevre
2001-11-21 18:50 ` Bart Schaefer
1 sibling, 0 replies; 12+ messages in thread
From: Vincent Lefevre @ 2001-11-21 18:01 UTC (permalink / raw)
To: zsh-users
On Wed, Nov 21, 2001 at 17:51:05 +0000, Zefram wrote:
> Bart Schaefer wrote:
> > alias '\ls'='command ls'
>
> Or you could less confusingly alias ".ls" or something like that.
But this wouldn't be a generic method to escape a function. Anyway,
another user suggested to use "=ls".
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 17:51 ` Zefram
2001-11-21 18:01 ` Vincent Lefevre
@ 2001-11-21 18:50 ` Bart Schaefer
1 sibling, 0 replies; 12+ messages in thread
From: Bart Schaefer @ 2001-11-21 18:50 UTC (permalink / raw)
To: Zefram, zsh-users
On Nov 21, 5:51pm, Zefram wrote:
}
} The ability to alias a particular pattern of quoting always seems to
} me to lack any basis in theoretical sense or in practical utility
It's not really aliasing a particular pattern of quoting. It's aliasing
an arbitrary string of characters before quoting is stripped. From the
viewpoint of aliases, `\ls' is not really quoting the `l'; it's simply
not the same word as `ls' at the time aliases are resolved, and therefore
doesn't match an alias for `ls'.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-21 16:15 ` Vincent Lefevre
2001-11-21 17:08 ` Zefram
@ 2001-11-23 10:03 ` Giorgos Keramidas
2001-11-23 21:34 ` Vincent Lefevre
1 sibling, 1 reply; 12+ messages in thread
From: Giorgos Keramidas @ 2001-11-23 10:03 UTC (permalink / raw)
To: Zsh-users List
On 2001-11-21 17:15:59, Vincent Lefevre wrote:
> On Wed, Nov 21, 2001 at 16:07:52 +0000, Bart Schaefer wrote:
> > On Nov 21, 10:29am, Bruno Bonfils wrote:
> > }
> > } alias ls='ls --color'
> > } alias 'ls -l'='ls -lh --color' <- doesn't work :(
> >
> > This is what shell functions are for.
>
> Well, this is a bit annoying as a function can't be avoided with "\".
But there is always /bin/ls :)
-giorgos
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: few questions
2001-11-23 10:03 ` Giorgos Keramidas
@ 2001-11-23 21:34 ` Vincent Lefevre
0 siblings, 0 replies; 12+ messages in thread
From: Vincent Lefevre @ 2001-11-23 21:34 UTC (permalink / raw)
To: Zsh-users List
On Fri, Nov 23, 2001 at 12:03:03 +0200, Giorgos Keramidas wrote:
> But there is always /bin/ls :)
No, the unbroken ls isn't always in /bin, and its path may be a bit
too long to type. :)
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2001-11-23 21:35 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-21 9:29 few questions Bruno Bonfils
2001-11-21 9:48 ` Max Ischenko
2001-11-21 16:07 ` Bart Schaefer
2001-11-21 16:15 ` Vincent Lefevre
2001-11-21 17:08 ` Zefram
2001-11-21 17:22 ` Bart Schaefer
2001-11-21 17:28 ` Bart Schaefer
2001-11-21 17:51 ` Zefram
2001-11-21 18:01 ` Vincent Lefevre
2001-11-21 18:50 ` Bart Schaefer
2001-11-23 10:03 ` Giorgos Keramidas
2001-11-23 21:34 ` Vincent Lefevre
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).