Quantcast
Channel: Environment Variable for Username - Ask Ubuntu
Browsing all 5 articles
Browse latest View live

Answer by Keith Thompson for Environment Variable for Username

As the other answers say, $USER is usually set to the name of the current user account.But at least on my system (Ubuntu 14.04) the $USER environment variable is not set for cron jobs. Instead, you can...

View Article



Answer by Byte Commander for Environment Variable for Username

There might be a caveat if you plan to read the $USER environment variable in a command starting with sudo. Bash variable expansion takes place before executing sudo to switch users, that means the...

View Article

Answer by Arronical for Environment Variable for Username

The Linux version environment variable to refer to the current user is USER.To get the output you'd like to see use $USER in your command: echo $USERAnd to use it in another string such as a...

View Article

Answer by Rinzwind for Environment Variable for Username

$USERwill change it into your username.Examplerinzwind@schijfwereld:~$ echo $USERrinzwindThere are more...~$ cd /tmp:/tmp$ echo $HOME/home/rinzwind:/tmp$ echo $PWD/tmp$ echo $HOSTNAMEschijfwereldTo...

View Article

Environment Variable for Username

What is the Linux equivalent of %username%?I need to run a script on multiple Linux boxes every few days. I made a .sh file, and it works fine. The script deletes some files at a certain path. Problem...

View Article

Browsing all 5 articles
Browse latest View live




Latest Images