What is `$1- hour`? [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
-3
down vote

favorite













This question already has an answer here:



  • Variable with colon dash $VAR:-

    1 answer



From https://stackoverflow.com/a/27595805/156458



date -d "next $1- hour" '+%H:00:00'


What is $1- hour? Is it some shell parameter expansion, or input format of date and time?



Why does $1 hour not work?



Thanks.







share|improve this question











marked as duplicate by Ipor Sircer, αғsнιη, Vlastimil, schily, Jesse_b Jul 29 at 14:20


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.




















    up vote
    -3
    down vote

    favorite













    This question already has an answer here:



    • Variable with colon dash $VAR:-

      1 answer



    From https://stackoverflow.com/a/27595805/156458



    date -d "next $1- hour" '+%H:00:00'


    What is $1- hour? Is it some shell parameter expansion, or input format of date and time?



    Why does $1 hour not work?



    Thanks.







    share|improve this question











    marked as duplicate by Ipor Sircer, αғsнιη, Vlastimil, schily, Jesse_b Jul 29 at 14:20


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















      up vote
      -3
      down vote

      favorite









      up vote
      -3
      down vote

      favorite












      This question already has an answer here:



      • Variable with colon dash $VAR:-

        1 answer



      From https://stackoverflow.com/a/27595805/156458



      date -d "next $1- hour" '+%H:00:00'


      What is $1- hour? Is it some shell parameter expansion, or input format of date and time?



      Why does $1 hour not work?



      Thanks.







      share|improve this question












      This question already has an answer here:



      • Variable with colon dash $VAR:-

        1 answer



      From https://stackoverflow.com/a/27595805/156458



      date -d "next $1- hour" '+%H:00:00'


      What is $1- hour? Is it some shell parameter expansion, or input format of date and time?



      Why does $1 hour not work?



      Thanks.





      This question already has an answer here:



      • Variable with colon dash $VAR:-

        1 answer









      share|improve this question










      share|improve this question




      share|improve this question









      asked Jul 29 at 13:28









      Tim

      22.5k61222398




      22.5k61222398




      marked as duplicate by Ipor Sircer, αғsнιη, Vlastimil, schily, Jesse_b Jul 29 at 14:20


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by Ipor Sircer, αғsнιη, Vlastimil, schily, Jesse_b Jul 29 at 14:20


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          It's a parameter expansion, expanding to the text hour if the first positional parameter is unset. Had the expansion been $1:- hour, then it would have expanded to hour also if the first positional parameter was empty (but set).



          The code in the StackOverflow answer that you are linking to expects the first positional parameter to be something like day or week, but defaults to hour using this expansion if the argument is not provided.






          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            It's a parameter expansion, expanding to the text hour if the first positional parameter is unset. Had the expansion been $1:- hour, then it would have expanded to hour also if the first positional parameter was empty (but set).



            The code in the StackOverflow answer that you are linking to expects the first positional parameter to be something like day or week, but defaults to hour using this expansion if the argument is not provided.






            share|improve this answer



























              up vote
              2
              down vote



              accepted










              It's a parameter expansion, expanding to the text hour if the first positional parameter is unset. Had the expansion been $1:- hour, then it would have expanded to hour also if the first positional parameter was empty (but set).



              The code in the StackOverflow answer that you are linking to expects the first positional parameter to be something like day or week, but defaults to hour using this expansion if the argument is not provided.






              share|improve this answer

























                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                It's a parameter expansion, expanding to the text hour if the first positional parameter is unset. Had the expansion been $1:- hour, then it would have expanded to hour also if the first positional parameter was empty (but set).



                The code in the StackOverflow answer that you are linking to expects the first positional parameter to be something like day or week, but defaults to hour using this expansion if the argument is not provided.






                share|improve this answer















                It's a parameter expansion, expanding to the text hour if the first positional parameter is unset. Had the expansion been $1:- hour, then it would have expanded to hour also if the first positional parameter was empty (but set).



                The code in the StackOverflow answer that you are linking to expects the first positional parameter to be something like day or week, but defaults to hour using this expansion if the argument is not provided.







                share|improve this answer















                share|improve this answer



                share|improve this answer








                edited Jul 29 at 13:56


























                answered Jul 29 at 13:43









                Kusalananda

                101k13199311




                101k13199311












                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay