Description: Just a blog about every detail encountered.
Getting the current username, it sounds like a very easy task:
1 2 $ bash -c 'echo "$USER"' chao But depending on the environment variable is not reliable, it can be easily overridden:
1 2 $ USER=foo bash -c 'echo "$USER"' foo Or just simply fail to work: