Passing parameters to an alias in ksh ...under AIX
Alan M. Carroll
carroll at cs.uiuc.edu
Fri Dec 7 10:54:16 AEST 1990
In article <1235 at lafayet.UUCP>, rob at lafayet.UUCP (Rob Freyder) writes:
> I am trying to pass a parameter to an alias under AIX on the RS6000.
You cannot access parameters in ksh alias's as you can in csh. What
you want is a function, instead. Here is my code to set my xterm
title:
# <ESC> ] 0 ; string <BEL> and string will become the title and icon name
# <ESC> ] 1 ; string <BEL> for icon name only
# <ESC> ] 2 ; string <BEL> for title name only
# control codes removed - you'll have to fix them on your end.
XTITLEPRE="^[]2;"
XICONPRE="^[]1;"
XPOST="^G"
unalias cd
function CD
{
\cd $@
PRWD=${PWD##${HOME}}
if [ ! "${PRWD}" = "${PWD}" ] ; then
PRWD="~$PRWD"
fi
if [[ "$TERM" = "xterm" && "$NOXTITLE" = "" ]] ; then
print -n -r "${XTITLEPRE}${XTITLE}${PRWD}@${HOST}${XPOST}"
fi
}
alias cd=CD
# Fix up the icon title just once, with the host.
if [ "$TERM" = "xterm" ] ; then
print -n -r "${XICONPRE}${HOST}${XPOST}"
fi
--
Alan M. Carroll "It's psychosomatic. You need a lobotomy.
Epoch Development Team I'll get a saw."
CS Grad / U of Ill @ Urbana ...{ucbvax,pur-ee,convex}!cs.uiuc.edu!carroll
More information about the Comp.unix.shell
mailing list