I saw this example $ whoamiMatsP$ g++ -Wall -std=c++0x getenv.cpp $ ./a.outMatsP$ export USER=DonaldDuck$ ./a.outDonaldDuckbut for me it doesn't work. I am in a Debian machine. I used export -p and indeed the variable changed. I refreshed the bachrc, still nothing. How to achiece the above? whoami displays the default value.
Using export USER=myName doesn't change the output of whoami
debian;environment variables;bashrc;whoami