[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
listing aliases
From: |
Andrew Basterfield |
Subject: |
listing aliases |
Date: |
Mon, 26 May 2003 00:01:46 +0100 |
Hi
I've written an alias that saves the current shell's aliases to ~/.shrc
when you list aliases zsh and ksh don't prepend the word alias to
every line
ksh$ alias
l.='ls -d .*'
ll='ls -l'
ll.='ls -ld .*'
lla='ls -la'
ls='ls --color=auto'
bash$ alias
alias l.='ls -d .*'
alias ll='ls -l'
alias ll.='ls -ld .*'
alias lla='ls -la'
alias ls='ls --color=auto'
Here is my patch to drop the initial alias string when the shell is in
posix mode, thus not breaking stuff that expects the default behaviour.
POSIX says 'alias' should work like Korn 'alias', in my interpretation.
http://www.opengroup.org/onlinepubs/007904975/utilities/alias.html#tag_04_02_18
Is this a sensible suggestion or Not Clever?
--Andrew
--- builtins/alias.def.orig Sun May 25 22:18:10 2003
+++ builtins/alias.def Sun May 25 22:20:09 2003
@@ -196,9 +196,15 @@ print_alias (alias)
alias_t *alias;
{
char *value;
+ extern int posixly_correct;
value = sh_single_quote (alias->value);
- printf ("alias %s=%s\n", alias->name, value);
+ if (posixly_correct)
+ {
+ printf ("%s=%s\n", alias->name, value);
+ } else {
+ printf ("alias %s=%s\n", alias->name, value);
+ }
free (value);
fflush (stdout);
--
http://cemetery.homeunix.org
pgplEiKjnxOdh.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- listing aliases,
Andrew Basterfield <=