61 Actions

Who sets $USER and $USERNAME environment variables?@JosephR. For sudo echo $USER, the shell expands $USER, then calls sudo. So of course it doesn't produce the same output as whoami. Like sudo whoami, sudo sh -c 'echo $USER' does (typically) output root. Regarding your comment about whoami using the EUID, note that sudo whoami would output root even if whoami used the UID. sudo sets both EUID and UID for the command it runs (except in the very unusual situation that you explicitly configure it to behave otherwise). Compare sudo id -u to sudo id -ru.

Oct4

comment

Why doesn't my ~/.bash_profile work?"Ubuntu specifically discourages using .profile (link)" The wiki did once (absurdly) discourage that; that's been fixed. (Note /etc/profile does remain discouraged for systemwide assignments, in preference for adding scripts to /etc/profile.d.) Per-user .profile files are now presented as one of the recommended ways to set per-user environment variables: "Suitable files for environment variable settings that should affect just a particular user (rather than the system as a whole) are ~/.pam_environment and ~/.profile."

Desktop background appears black when using XFCEDoes anything different happen if you kill the running xfdesktop process before attempting to run it again? You can do this with killall xfdesktop (then run that again a few seconds later, and if you don't get xfdesktop: no process found, forcibly kill it with killall -KILL xfdesktop). After killing xfdesktop, try running it again, this time without&. The & isn't causing the problem, but by running it in the foreground you're more likely to see output in the terminal that might reveal the nature of the problem. (You can edit your question with detailed results.)

Is it recommended to use zsh instead of bash scripts?The other thing to keep in mind about bash scripts on BSD systems (other than OS X ...if you consider it a BSD system) is that even if bash exists, it is usually not /bin/bash, so a shebang line #!/bin/bash won't usually work. In cases where bash is actually installed, I believe #!/usr/bin/env bash usually will.