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