Can't get $(date +%F) set as environment variable
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I would like to create an environment 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?
bash environment-variables
add a comment |
I would like to create an environment 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?
bash environment-variables
add a comment |
I would like to create an environment 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?
bash environment-variables
I would like to create an environment 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?
bash environment-variables
bash environment-variables
edited Mar 28 at 3:11
Pang
14126
14126
asked Apr 24 '13 at 0:55
Mark McKennaMark McKenna
3112
3112
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
~/.pam_environment
is not a script file. Use ~/.profile
instead:
export TODAY=$(date +%F)
add a comment |
You forgot the "quotes" Here is a Cool Link for more examples.
TODAY= date +"%F"
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
2
@ScottGoodgame That's not the problem. It is not generally necessary to quote%
, and although the reference you provided follows this style, it does not actually say one has to do so. Try some examples from that page without quotes (e.g.,date +%m-%d-%y
). It works fine. In addition,TODAY= date +"%F"
actually runsdate +"%F"
withTODAY
set to the empty string in its environment.
– Eliah Kagan
Jan 25 '17 at 11:23
add a comment |
$ export DATE=`date +"%F"`
$ echo $DATE
2014-05-30
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f284781%2fcant-get-date-f-set-as-environment-variable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
~/.pam_environment
is not a script file. Use ~/.profile
instead:
export TODAY=$(date +%F)
add a comment |
~/.pam_environment
is not a script file. Use ~/.profile
instead:
export TODAY=$(date +%F)
add a comment |
~/.pam_environment
is not a script file. Use ~/.profile
instead:
export TODAY=$(date +%F)
~/.pam_environment
is not a script file. Use ~/.profile
instead:
export TODAY=$(date +%F)
answered May 29 '14 at 17:24
Gunnar HjalmarssonGunnar Hjalmarsson
19.7k23461
19.7k23461
add a comment |
add a comment |
You forgot the "quotes" Here is a Cool Link for more examples.
TODAY= date +"%F"
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
2
@ScottGoodgame That's not the problem. It is not generally necessary to quote%
, and although the reference you provided follows this style, it does not actually say one has to do so. Try some examples from that page without quotes (e.g.,date +%m-%d-%y
). It works fine. In addition,TODAY= date +"%F"
actually runsdate +"%F"
withTODAY
set to the empty string in its environment.
– Eliah Kagan
Jan 25 '17 at 11:23
add a comment |
You forgot the "quotes" Here is a Cool Link for more examples.
TODAY= date +"%F"
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
2
@ScottGoodgame That's not the problem. It is not generally necessary to quote%
, and although the reference you provided follows this style, it does not actually say one has to do so. Try some examples from that page without quotes (e.g.,date +%m-%d-%y
). It works fine. In addition,TODAY= date +"%F"
actually runsdate +"%F"
withTODAY
set to the empty string in its environment.
– Eliah Kagan
Jan 25 '17 at 11:23
add a comment |
You forgot the "quotes" Here is a Cool Link for more examples.
TODAY= date +"%F"
You forgot the "quotes" Here is a Cool Link for more examples.
TODAY= date +"%F"
answered Apr 24 '13 at 1:16
Scott GoodgameScott Goodgame
2,359820
2,359820
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
2
@ScottGoodgame That's not the problem. It is not generally necessary to quote%
, and although the reference you provided follows this style, it does not actually say one has to do so. Try some examples from that page without quotes (e.g.,date +%m-%d-%y
). It works fine. In addition,TODAY= date +"%F"
actually runsdate +"%F"
withTODAY
set to the empty string in its environment.
– Eliah Kagan
Jan 25 '17 at 11:23
add a comment |
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
2
@ScottGoodgame That's not the problem. It is not generally necessary to quote%
, and although the reference you provided follows this style, it does not actually say one has to do so. Try some examples from that page without quotes (e.g.,date +%m-%d-%y
). It works fine. In addition,TODAY= date +"%F"
actually runsdate +"%F"
withTODAY
set to the empty string in its environment.
– Eliah Kagan
Jan 25 '17 at 11:23
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
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
2
2
@ScottGoodgame That's not the problem. It is not generally necessary to quote
%
, and although the reference you provided follows this style, it does not actually say one has to do so. Try some examples from that page without quotes (e.g., date +%m-%d-%y
). It works fine. In addition, TODAY= date +"%F"
actually runs date +"%F"
with TODAY
set to the empty string in its environment.– Eliah Kagan
Jan 25 '17 at 11:23
@ScottGoodgame That's not the problem. It is not generally necessary to quote
%
, and although the reference you provided follows this style, it does not actually say one has to do so. Try some examples from that page without quotes (e.g., date +%m-%d-%y
). It works fine. In addition, TODAY= date +"%F"
actually runs date +"%F"
with TODAY
set to the empty string in its environment.– Eliah Kagan
Jan 25 '17 at 11:23
add a comment |
$ export DATE=`date +"%F"`
$ echo $DATE
2014-05-30
add a comment |
$ export DATE=`date +"%F"`
$ echo $DATE
2014-05-30
add a comment |
$ export DATE=`date +"%F"`
$ echo $DATE
2014-05-30
$ export DATE=`date +"%F"`
$ echo $DATE
2014-05-30
edited May 29 '14 at 16:42
Eric Carvalho
42.5k17118148
42.5k17118148
answered May 29 '14 at 16:23
user286563user286563
91
91
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f284781%2fcant-get-date-f-set-as-environment-variable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown