Path: utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox From: bfox@AUREL.CALTECH.EDU (Brian Fox) Newsgroups: gnu.bash.bug Subject: Defining alias Message-ID: <8907141318.AA07051@aurel.caltech.edu> Date: 14 Jul 89 13:18:27 GMT References: <8907141107.AA19130@amalthea.prosys.se> Sender: daemon@tut.cis.ohio-state.edu Reply-To: bfox@aurel.caltech.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 50 Date: Fri, 14 Jul 89 13:07:19 +0200 From: thomas@prosys.ai.mit.edu (Thomas Thyberg) Bash version 1.02 SUN 3/60 SUNOS3.5 gcc version 1.35 Hi. There is something I really would like to be able to do in bash and that is to write my alias definitions in my .bashrc something like this: 1: alias \ 'pd= pushd' \ 'ud= popd' \ 'back= cd $OLDPWD' \ etc... or 2: alias \ 'pd =pushd' \ 'ud =popd' \ 'back =cd $OLDPWD' \ etc... to make it more readable (I think it gets more readably anyway). Gee, you might want to do something like this: function alias () { local name=$1 shift local value="$*" if [ "$name" = "" ]; then builtin alias elif [ "$value" = "" ]; then builtin alias $name else builtin alias $1="$value" } Now you can type: alias ls ls -F alias - cd ~- Brian