Sample Header Ad - 728x90

command whoami and echo $USER are giving different outputs how is that even possible?

1 vote
0 answers
1504 views
If I don't fix this I can't properly run bash scripts that checks whether the $USER is root in an IF statement, because, as it is, the $USER is never root, even when the whoami is the root. No matter if I su to root, I keep being whatever user I was before, at least for the $USER variable. How do I fix this? I have tried setting the variable $USER to be equal to the output of the command whoami on the .zshrc file, but it didnt work at all.
Asked by vcedraz- (11 rep)
Aug 25, 2022, 03:52 PM