Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to create an evironment variable that will output the current date. I have added the following to ~/.pam_environment:

TODAY=$(date +%F)

Apparently you have to log out after changing ~/.pam_environment. I did that but

echo $TODAY

outputs a blank line.

What am I doing wrong?

share|improve this question

You forgot the "quotes" Here is a Cool Link for more examples.

TODAY= date +"%F"
share|improve this answer
Unfortunately that did not work. I tried experimenting a bit and added the following to ~/.pam_environment: TODAY=date +"%F" TODAYS=$(date +"%F") NOW=$(date +"%m-%d-%Y") None of these are working – Mark McKenna Apr 25 '13 at 1:32

~/.pam_environment is not a script file. Use ~/.profile instead:

export TODAY=$(date +%F)
share|improve this answer
$ export DATE=`date +"%F"`
$ echo $DATE
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.