[m-rev.] Added vim directory to distribution

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Mar 14 17:03:40 AEDT 2002


On 14-Mar-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Fergus Henderson, Thursday, 14 March 2002:
> > On 14-Mar-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> > > Fergus Henderson, Wednesday, 13 March 2002:
> > > > > 
> > > > > +% $([ -n "$USERNAME" ] && echo $USERNAME "")<$USER@$(hostname -d)>
> > > > 
> > > > Using `whoami` is probably more reliable than checking $USERNAME
> > > 
> > > On ceres, at least, whoami simply returns `rafe'.
> > 
> > Yes, `whoami` just returns the user name.
> > To get a full address, you need to use `hostname` as well:
> > 
> > 		`whoami`@`hostname -f`
> > 
> > Or alternatively, use environment variables by default,
> > with `whoami` and `hostname` as fallbacks:
> > 
> > 		${USERNAME-`whoami`}@${FROM_HEADER-`hostname -f`}
> 
> The idea behind USERNAME is that I set it to "Ralph Becket" in my
> .profile.  If you don't have it, $USER@`hostname -d` should be
> sufficient.

Oh, I see.  I misread the code.

The code you've written has a minor quoting bug, which means
it won't handle user names with special characters in them
(e.g. USERNAME="Jon Dell'Oro").  Instead of

	echo $USERNAME ""

it should be

	echo "$USERNAME "

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list