I saw this example
$ whoami
MatsP
$ g++ -Wall -std=c++0x getenv.cpp
$ ./a.out
MatsP
$ export USER=DonaldDuck
$ ./a.out
DonaldDuck
but 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.