Difficulty executing commands in the shell script
-
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\ 2All 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?
-
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 ~/DesktopOr this:
/usr/local/bin/code -n ~/DesktopYou can type this command to find the path for docker-compose:
which docker-compose -
Hello russ, thank you very much it worked perfectly.
Thank you.
-
@Alcir-Junior, awesome.
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