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

Re: why is grep behaving this way ?

Salvatore Iovene wrote:
> 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.
> Weird. Consiedering that this works:
> who | grep `whoami`
> Where's the catch?
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.

Håkon Alstadheim 
spamtrap: finnesikke@alstadheim.priv.no -- 1 hit & you are out

Reply to: