ksh prompt

Ron Heiby heiby at mcdchg.chg.mcd.mot.com
Wed Mar 6 10:33:16 AEST 1991


lvc at cbnews.att.com (lawrence.v.cipriani) writes:
>I suggest the cd in function ch be quoted:

>	function ch {
>		if "cd" ${*:-''}
...
>so that a second ". $ENV" will not see 'ch' inside of function ch.

Yes, that seems to be a good idea.  I never ran into that, because I
never do a second ". $ENV".  Actually, I almost never do one, allowing
ksh to do it for me as it starts up.  With the prompt string all this
gives you, it's pretty obvious that it has already been done!

>Why not use "${@:-''}" instead of ${*:-''} ?

Using the at-sign version ensures that if you pass multiple parameters
to cd, that the parameters will be seperated by space characters.  The
asterisk version uses the first character of $IFS as the seperator.  I
don't see that it really matters all that much.  Of course, if you
don't have a space in your IFS string for some wierd reason, then
using the at-sign here will leave you with your parameters lumped
together with space seperators that will not be interpreted to be
seperators (since space isn't in $IFS)!  I guess that's a pretty good
reason to leave this one as is!
-- 
Ron Heiby, heiby at chg.mcd.mot.com	Moderator: comp.newprod
"Wrong is wrong, even when it helps you." Popeye



More information about the Comp.unix.shell mailing list