Can't get $(date +%F) set as environment variableEnvironment variable blank inside applicationEditing the...

Sort a list by elements of another list

Is a stroke of luck acceptable after a series of unfavorable events?

Different result between scanning in Epson's "color negative film" mode and scanning in positive -> invert curve in post?

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

Why, precisely, is argon used in neutrino experiments?

Implement the Thanos sorting algorithm

How does buying out courses with grant money work?

Why are there no referendums in the US?

Are student evaluations of teaching assistants read by others in the faculty?

A particular customize with green line and letters for subfloat

Did Dumbledore lie to Harry about how long he had James Potter's invisibility cloak when he was examining it? If so, why?

How do I go from 300 unfinished/half written blog posts, to published posts?

Did the DC-9 ever use RATO in revenue service?

How does it work when somebody invests in my business?

CREATE opcode: what does it really do?

Is expanding the research of a group into machine learning as a PhD student risky?

Closest Prime Number

How to pronounce the slash sign

Two monoidal structures and copowering

Is HostGator storing my password in plaintext?

Integer addition + constant, is it a group?

Unreliable Magic - Is it worth it?

Would this custom Sorcerer variant that can only learn any verbal-component-only spell be unbalanced?

Term for the "extreme-extension" version of a straw man fallacy?



Can't get $(date +%F) set as environment variable


Environment variable blank inside applicationEditing the environment variablesetting PATH to /etc/profile or /etc/environment does not work with sudoRunning a service ignores environment variablesHow to set session-wide environment variables and PATH?Error while creating environment variableVariables listed in a variable are echoed instead of processedIs there really a Bug in ls -l not observing the Environment Variable TIME_STYLE?Change global environment variable using a script that is started using xbindkeys?How can I create an environment variable that contains the IP address of an adapter that is set via DHCP?













6















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?










share|improve this question





























    6















    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?










    share|improve this question



























      6












      6








      6








      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?










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 mins ago









      Pang

      13926




      13926










      asked Apr 24 '13 at 0:55









      Mark McKennaMark McKenna

      3112




      3112






















          3 Answers
          3






          active

          oldest

          votes


















          4














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



          export TODAY=$(date +%F)





          share|improve this answer































            2














            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








            • 1





              @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





















            0














            $ export DATE=`date +"%F"`
            $ echo $DATE
            2014-05-30





            share|improve this answer

























              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
              });


              }
              });














              draft saved

              draft discarded


















              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









              4














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



              export TODAY=$(date +%F)





              share|improve this answer




























                4














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



                export TODAY=$(date +%F)





                share|improve this answer


























                  4












                  4








                  4







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



                  export TODAY=$(date +%F)





                  share|improve this answer













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



                  export TODAY=$(date +%F)






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 29 '14 at 17:24









                  Gunnar HjalmarssonGunnar Hjalmarsson

                  19.6k23461




                  19.6k23461

























                      2














                      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








                      • 1





                        @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


















                      2














                      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








                      • 1





                        @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
















                      2












                      2








                      2







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



                      TODAY= date +"%F"





                      share|improve this answer













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



                      TODAY= date +"%F"






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Apr 24 '13 at 1:16









                      Scott GoodgameScott Goodgame

                      2,357820




                      2,357820













                      • 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








                      • 1





                        @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





















                      • 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








                      • 1





                        @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



















                      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






                      1




                      1





                      @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













                      0














                      $ export DATE=`date +"%F"`
                      $ echo $DATE
                      2014-05-30





                      share|improve this answer






























                        0














                        $ export DATE=`date +"%F"`
                        $ echo $DATE
                        2014-05-30





                        share|improve this answer




























                          0












                          0








                          0







                          $ export DATE=`date +"%F"`
                          $ echo $DATE
                          2014-05-30





                          share|improve this answer















                          $ export DATE=`date +"%F"`
                          $ echo $DATE
                          2014-05-30






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited May 29 '14 at 16:42









                          Eric Carvalho

                          42.3k17115147




                          42.3k17115147










                          answered May 29 '14 at 16:23









                          user286563user286563

                          91




                          91






























                              draft saved

                              draft discarded




















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

                              Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

                              Should I use Docker or LXD?How to cache (more) data on SSD/RAM to avoid spin up?Unable to get Windows File...