TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Difficulty executing commands in the shell script

    Scheduled Pinned Locked Moved General Discussion
    4 Posts 2 Posters 702 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Alcir JuniorA Offline
      Alcir Junior
      last edited by

      Hello everyone I'm having trouble running some command lines in my shell script:

      #!/bin/sh
      # cd Cloud/laradock && docker-compose stop
      
      open -a mail
      open -a whatsapp
      open -a slack
      cd ~/Cloud/laradock && docker-compose up -d nginx mysql postgres mongo redis
      open -a google\ chrome http://dev.laravel.library
      code -n ~/Cloud/Dropbox\ \(Personal\)/Projects/Caju/PHP/Frameworks/Laravel/Library/
      open -a memory\ clean\ 2
      

      All lines that start with the open command execute normally, but the lines that I access a folder to run the docker-compose and the line where I execute the command to open a folder in vscode using the code does not work.

      Has anyone ever experienced this, thanks?

      RussR 1 Reply Last reply Reply Quote 0
      • RussR Offline
        Russ @Alcir Junior
        last edited by Russ

        @Alcir-Junior,

        In the shell script you must not have all of your normal aliases and environments variables available, so you'll generally need to specify the full path to things. Like for vscode, this works:

        /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code -n ~/Desktop
        

        Or this:

        /usr/local/bin/code -n ~/Desktop
        

        You can type this command to find the path for docker-compose:

        which docker-compose
        

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • Alcir JuniorA Offline
          Alcir Junior
          last edited by Alcir Junior

          Hello russ, thank you very much it worked perfectly.

          Thank you.

          RussR 1 Reply Last reply Reply Quote 0
          • RussR Offline
            Russ @Alcir Junior
            last edited by

            @Alcir-Junior, awesome.

            Russell VanderMey

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post