How to create script to change directory then run

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











up vote
0
down vote

favorite












Evening all



I am trying to get a simple script to work that I can run from the desktop or have it load on login. All i want it to do is change do the directory /users/me/sites/sass and then run the command 'npm run compile:sass' thats it. I have tried automator but it throws out an error and wont run, i just tried to save it as an application with a run shell script option and put the above in.



Would be grateful for any advice, seems a pretty simple thing but just cant get it to play.



Thanks guys







share|improve this question
























    up vote
    0
    down vote

    favorite












    Evening all



    I am trying to get a simple script to work that I can run from the desktop or have it load on login. All i want it to do is change do the directory /users/me/sites/sass and then run the command 'npm run compile:sass' thats it. I have tried automator but it throws out an error and wont run, i just tried to save it as an application with a run shell script option and put the above in.



    Would be grateful for any advice, seems a pretty simple thing but just cant get it to play.



    Thanks guys







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Evening all



      I am trying to get a simple script to work that I can run from the desktop or have it load on login. All i want it to do is change do the directory /users/me/sites/sass and then run the command 'npm run compile:sass' thats it. I have tried automator but it throws out an error and wont run, i just tried to save it as an application with a run shell script option and put the above in.



      Would be grateful for any advice, seems a pretty simple thing but just cant get it to play.



      Thanks guys







      share|improve this question












      Evening all



      I am trying to get a simple script to work that I can run from the desktop or have it load on login. All i want it to do is change do the directory /users/me/sites/sass and then run the command 'npm run compile:sass' thats it. I have tried automator but it throws out an error and wont run, i just tried to save it as an application with a run shell script option and put the above in.



      Would be grateful for any advice, seems a pretty simple thing but just cant get it to play.



      Thanks guys









      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 5 '17 at 19:53









      rufus

      1114




      1114




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          First, get it to work from the command line, so you know everything is working as it should, then focus on running that script from your gui.



          Step 1 - create the script



          echo "cd /users/me/sites/sass ; npm run compile: sass" >> /users/me/myscript


          Step 2 - make the script executable



          chmod 775 /users/me/myscript


          Step 3 - run it and confirm proper operation



          . /users/me/myscript


          Step 4 - add a link to the script from your gui



          (gui dependent, sorry, can't help you here)





          share|improve this answer




















          • In addition, for the "or load on login" ... with the tag of OSx... SuperUser MacOSx Run Command on Startup Question
            – RubberStamp
            Nov 5 '17 at 21:30










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



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402714%2fhow-to-create-script-to-change-directory-then-run%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













          First, get it to work from the command line, so you know everything is working as it should, then focus on running that script from your gui.



          Step 1 - create the script



          echo "cd /users/me/sites/sass ; npm run compile: sass" >> /users/me/myscript


          Step 2 - make the script executable



          chmod 775 /users/me/myscript


          Step 3 - run it and confirm proper operation



          . /users/me/myscript


          Step 4 - add a link to the script from your gui



          (gui dependent, sorry, can't help you here)





          share|improve this answer




















          • In addition, for the "or load on login" ... with the tag of OSx... SuperUser MacOSx Run Command on Startup Question
            – RubberStamp
            Nov 5 '17 at 21:30














          up vote
          0
          down vote













          First, get it to work from the command line, so you know everything is working as it should, then focus on running that script from your gui.



          Step 1 - create the script



          echo "cd /users/me/sites/sass ; npm run compile: sass" >> /users/me/myscript


          Step 2 - make the script executable



          chmod 775 /users/me/myscript


          Step 3 - run it and confirm proper operation



          . /users/me/myscript


          Step 4 - add a link to the script from your gui



          (gui dependent, sorry, can't help you here)





          share|improve this answer




















          • In addition, for the "or load on login" ... with the tag of OSx... SuperUser MacOSx Run Command on Startup Question
            – RubberStamp
            Nov 5 '17 at 21:30












          up vote
          0
          down vote










          up vote
          0
          down vote









          First, get it to work from the command line, so you know everything is working as it should, then focus on running that script from your gui.



          Step 1 - create the script



          echo "cd /users/me/sites/sass ; npm run compile: sass" >> /users/me/myscript


          Step 2 - make the script executable



          chmod 775 /users/me/myscript


          Step 3 - run it and confirm proper operation



          . /users/me/myscript


          Step 4 - add a link to the script from your gui



          (gui dependent, sorry, can't help you here)





          share|improve this answer












          First, get it to work from the command line, so you know everything is working as it should, then focus on running that script from your gui.



          Step 1 - create the script



          echo "cd /users/me/sites/sass ; npm run compile: sass" >> /users/me/myscript


          Step 2 - make the script executable



          chmod 775 /users/me/myscript


          Step 3 - run it and confirm proper operation



          . /users/me/myscript


          Step 4 - add a link to the script from your gui



          (gui dependent, sorry, can't help you here)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 5 '17 at 21:23









          captcha

          771614




          771614











          • In addition, for the "or load on login" ... with the tag of OSx... SuperUser MacOSx Run Command on Startup Question
            – RubberStamp
            Nov 5 '17 at 21:30
















          • In addition, for the "or load on login" ... with the tag of OSx... SuperUser MacOSx Run Command on Startup Question
            – RubberStamp
            Nov 5 '17 at 21:30















          In addition, for the "or load on login" ... with the tag of OSx... SuperUser MacOSx Run Command on Startup Question
          – RubberStamp
          Nov 5 '17 at 21:30




          In addition, for the "or load on login" ... with the tag of OSx... SuperUser MacOSx Run Command on Startup Question
          – RubberStamp
          Nov 5 '17 at 21:30

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402714%2fhow-to-create-script-to-change-directory-then-run%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?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay