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

    Difficulty executing commands in the shell script

    General Discussion
    2
    4
    184
    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
      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
        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
          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
            Russ @Alcir Junior
            last edited by

            @Alcir-Junior, awesome.

            Russell VanderMey

            1 Reply Last reply Reply Quote 0
            • First post
              Last post