I heard (although I can't find any sources for proof) that the USER environment variable may not be set in a old Unix shells (maybe even some obscure shells as well). What is the probability that it won't be set?
Tell me more
×
Super User is a question and answer site for
computer enthusiasts and power users. It's 100% free, no registration required.
|
|
The probability is very low. if you want a fallback when writing a script:
...will default $USER if it's unset. For really old pre-POSIX Bourne shells, you'd want:
|
|||
|
|
|
Well, are you expecting to use any old shells, or are you expecting users of your program to do so? Anyway, there's always |
|||
|
|