jeudi 7 avril 2016

Why is my Bash script (OSX) running from the Terminal, but not when double clicked?

Here is the full text of my bash script:

GitC.sh

#!/bin/bash

git add .
git status
echo “Are you sure you want to commit and push? y/n”
read yn
if [ “$yn”==“y” ];
    then
    echo “Message:“ 
    read m
    git commit -m “$m”
    git push
    sleep 5s
else
    git reset
    sleep 5s
fi

I have run chmod u+x on the file, and selected Terminal for the default run Application, but when I double click on it, I get a response saying

justins-mbp:~ Schwaitz$ /Users/Schwaitz/Desktop/JustWas/GitC.sh ; exit;

and the process will not continue. When I run it from the Terminal with the command ./GitC.sh, it runs perfectly.

Thoughts?

Aucun commentaire:

Enregistrer un commentaire