Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: few questions



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   



Messages sorted by: Reverse Date, Date, Thread, Author