I tryed to write my first executable.sh file. It's a simple rsync from a folder to a server with ssh:


rsync -avzSh --progress --partial /Users/me/PhpstormProjects/test/ me@destination-server.de:/home/me/www/test/

When I use this code direct in a terminal, it works fine. But when I put it in a file.sh and double click it, then I get an error:


  • 2
    Why include an image when you can just copy as paste the text? Why obfuscate a filename? – jordanm Mar 14 '17 at 20:32
  • because there is a error, when i close error, terminal close to... And i cant mark any before i close the error :P – Budi Mar 14 '17 at 20:39
  • You are running exit in your terminal, that's why it closes... – jordanm Mar 14 '17 at 20:49
  • 1
    Looks like you don't have execute permission on the script. chmod a+x executable.sh and see if that works – Fox Mar 14 '17 at 21:02
  • 1
    No. It's because you're not running the script in a terminal. You're running it by double-clicking on it. Because shell scripts run in a terminal, OS X is opening the terminal for the execution of the script, and once the script is done, it's OS X that is exiting the terminal. – Tim Kennedy Mar 14 '17 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.