[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: why is grep behaving this way ?



> > On Fri, Mar 02, 2007 at 03:07:37PM +0530, Bhasker C V wrote:
> >> [bhaskerv@cvsrep01 ~]$ who | grep `logname`
> >> logname: no login name
> >> Usage: grep [OPTION]... PATTERN [FILE]...
> >> Try `grep --help' for more information.

On 02.03.07 11:27, H?kon Alstadheim wrote:
> I'm running SuSE, and can reproduce the problem here. Seems logname does
> something weird when stdin is not your tty. Check this out:
> 
> hakon@armada~:0$ logname</dev/null
> logname: no login name
> 
> My manual-page has nothing to say. Try looking at the source if you must.

I'd say that logname detects logged user by checking terminal of stdin file
handle...

However, that's logname feature, use whoami or different utility 
-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
(R)etry, (A)bort, (C)ancer



Reply to: