Pass Parameter to a redirected script in Linux

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











up vote
0
down vote

favorite












I have two scripts, suppose they are s1.sh and s2.sh.



In s1, the code is



step = 0
.
.(omitted)
.
if [ $step -eq 19 ]; then

./s2.sh


In s2, the code is



step=0
.
. (many codes here, but omitted)
.
if [ $step -eq 18 ]; then
print "hello"


I want to run s1 from step 19, and then as s1 would call s2, I hope s2 could directly go to step 19 as well.



I heard someone talking about this before but I really could not remember the exact method. I am thinking the command codes to do this would be like :



./s1.sh --step 19 [some code?]--step 18


Any idea how to write the command line that could pass argument to two scripts as above ?










share|improve this question









New contributor




exteralvictor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    0
    down vote

    favorite












    I have two scripts, suppose they are s1.sh and s2.sh.



    In s1, the code is



    step = 0
    .
    .(omitted)
    .
    if [ $step -eq 19 ]; then

    ./s2.sh


    In s2, the code is



    step=0
    .
    . (many codes here, but omitted)
    .
    if [ $step -eq 18 ]; then
    print "hello"


    I want to run s1 from step 19, and then as s1 would call s2, I hope s2 could directly go to step 19 as well.



    I heard someone talking about this before but I really could not remember the exact method. I am thinking the command codes to do this would be like :



    ./s1.sh --step 19 [some code?]--step 18


    Any idea how to write the command line that could pass argument to two scripts as above ?










    share|improve this question









    New contributor




    exteralvictor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have two scripts, suppose they are s1.sh and s2.sh.



      In s1, the code is



      step = 0
      .
      .(omitted)
      .
      if [ $step -eq 19 ]; then

      ./s2.sh


      In s2, the code is



      step=0
      .
      . (many codes here, but omitted)
      .
      if [ $step -eq 18 ]; then
      print "hello"


      I want to run s1 from step 19, and then as s1 would call s2, I hope s2 could directly go to step 19 as well.



      I heard someone talking about this before but I really could not remember the exact method. I am thinking the command codes to do this would be like :



      ./s1.sh --step 19 [some code?]--step 18


      Any idea how to write the command line that could pass argument to two scripts as above ?










      share|improve this question









      New contributor




      exteralvictor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have two scripts, suppose they are s1.sh and s2.sh.



      In s1, the code is



      step = 0
      .
      .(omitted)
      .
      if [ $step -eq 19 ]; then

      ./s2.sh


      In s2, the code is



      step=0
      .
      . (many codes here, but omitted)
      .
      if [ $step -eq 18 ]; then
      print "hello"


      I want to run s1 from step 19, and then as s1 would call s2, I hope s2 could directly go to step 19 as well.



      I heard someone talking about this before but I really could not remember the exact method. I am thinking the command codes to do this would be like :



      ./s1.sh --step 19 [some code?]--step 18


      Any idea how to write the command line that could pass argument to two scripts as above ?







      linux bash command






      share|improve this question









      New contributor




      exteralvictor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      exteralvictor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 1 min ago





















      New contributor




      exteralvictor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 11 mins ago









      exteralvictor

      1




      1




      New contributor




      exteralvictor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      exteralvictor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      exteralvictor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Run export step in s1. Once you do that, the step variable will just be present in s2 without having to be explicitly passed when you call it.





          share




















          • I think export could work only two parameters are the same ? what if they are different ?
            – exteralvictor
            22 secs ago











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          exteralvictor is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475216%2fpass-parameter-to-a-redirected-script-in-linux%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Run export step in s1. Once you do that, the step variable will just be present in s2 without having to be explicitly passed when you call it.





          share




















          • I think export could work only two parameters are the same ? what if they are different ?
            – exteralvictor
            22 secs ago















          up vote
          0
          down vote













          Run export step in s1. Once you do that, the step variable will just be present in s2 without having to be explicitly passed when you call it.





          share




















          • I think export could work only two parameters are the same ? what if they are different ?
            – exteralvictor
            22 secs ago













          up vote
          0
          down vote










          up vote
          0
          down vote









          Run export step in s1. Once you do that, the step variable will just be present in s2 without having to be explicitly passed when you call it.





          share












          Run export step in s1. Once you do that, the step variable will just be present in s2 without having to be explicitly passed when you call it.






          share











          share


          share










          answered 4 mins ago









          Joseph Sible

          1,019213




          1,019213











          • I think export could work only two parameters are the same ? what if they are different ?
            – exteralvictor
            22 secs ago

















          • I think export could work only two parameters are the same ? what if they are different ?
            – exteralvictor
            22 secs ago
















          I think export could work only two parameters are the same ? what if they are different ?
          – exteralvictor
          22 secs ago





          I think export could work only two parameters are the same ? what if they are different ?
          – exteralvictor
          22 secs ago











          exteralvictor is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          exteralvictor is a new contributor. Be nice, and check out our Code of Conduct.












          exteralvictor is a new contributor. Be nice, and check out our Code of Conduct.











          exteralvictor is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475216%2fpass-parameter-to-a-redirected-script-in-linux%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

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

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?