Brad S. ([info]soniquev8) wrote in [info]macosx,
@ 2004-01-09 12:13:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Current mood: bored

interesting
I was futzing around in terminal, trying out some new tricks I'd learned from Mac OS X Hacks (good book by the way) and I discovered something interesting.

The whoami command shows, ironically enough, what the user ID is. By accident I typed in whoamI and it spit out much more information. Nothing is mentioned of this slightly altered command in the man for whoami, and there is no man for whoamI.

Nothing special, and everyone else probably knows about it, but I'm just really really bored right now.

EDIT: I did some more futzing and figured out that whoamI will not work in tcsh, only bash. Haven't had a chance to try the other shells yet, but I'm guessing it might be bash specific.




(Post a new comment)


[info]mfree
2004-01-09 09:27 am UTC (link)
I get command not found on whoamI. Are you on panther or jaguar?

(Reply to this) (Thread)


[info]soniquev8
2004-01-09 09:49 am UTC (link)
Panther 10.3.2. Admittedly I was SSHed into my box when I discovered it, but I assume it would work via terminal as well. I guess I'll try it when I get home as well.

(Reply to this) (Parent)


[info]winterlady
2004-01-09 09:27 am UTC (link)
I'm glad you posted... I think little tricks like that are cool. I'll have to try it when I get home.

Far, far, far away from my nasty Win2K box.

Far away...

(Reply to this)


[info]antjedi
2004-01-09 10:01 am UTC (link)
I get the same "command not found" error.

I got 10.3.2, x11, and Dev Tools installed--no go.

(Reply to this)


[info]wibbble
2004-01-09 10:03 am UTC (link)
It works in tcsh if you specify the full path: /usr/bin/whoamI

Perhaps 'whoami' is a built-in in tcsh, and so it chokes on the capitalised version.

'whoami' and 'whoamI' are the same binary in Mac OS X, since HFS is case-insensitive. The code must check to see how it's invoked.

(Reply to this) (Thread)


[info]charles
2004-01-09 07:35 pm UTC (link)
'whoami', 'id' and 'groups' are all hard-links to the same file.

(Reply to this) (Parent)


[info]charles
2004-01-09 07:45 pm UTC (link)
I think it doesn't work on tcsh because tcsh maintains its own search-path. Sometimes, when you rename or move a binary around in your PATH, you have to run the tcsh built-in 'rehash' before tcsh can find it. bash either doesn't maintain an internal hash, or it falls back onto the filesystem when it can't find anything. So bash finds 'whoamI', because it asks the case-insensitive filesystem, whereas tcsh doesn't because it asks its internal, as-sensitive map.

(Reply to this) (Parent)


Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…