1 Replies - 587 Views - Last Post: 31 March 2017 - 06:11 AM

#1 robertford8080  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-March 17

build shortcut using Mac OS terminal

Posted 31 March 2017 - 12:12 AM

I'm trying to build a shortcut to run a python code. This code was built my developer who is now missing in action. I'm not able to write code in Mac OS terminal. In any case, I have two pythons files in the folder proofs. When I hit jj on the terminal it runs the code 5.7.16. I thought if I changed the first line from

FPTH="/Users/robertford/PycharmProjects/inference_engine2/inference2/Proofs/5.7.16.py"

to

FPTH="/Users/robertford/PycharmProjects/inference_engine2/inference2/Proofs/prove.py"

then the short cut would run the "prove" file but it doesn't. It continues to run the 5.7.16 file. So I'm trying to build a second short cut where if I hit kk then it runs the prove file located in the proofs folder. Any help would be appreciated. Don't worry about the stuff where it says excel, MySQL and django. That's not important.



FPTH="/Users/robertford/PycharmProjects/inference_engine2/inference2/Proofs/prove.py"

vmysql=$(grep "mysql =" $FPTH | cut -d'=' -f2)

vexcel=$(grep “excel =" $FPTH | cut -d'=' -f2)

echo $vexcel

echo $vmysql

if [ "$vexcel" == "True" ] ; then

echo "Excel"

elif [ "$vmysql" = "True" ] 

then

echo "Mysql"

else

echo "Django"

fi

if [ "$vexcel" = "True" ] ; then

echo "Excel is set”

python $FPTH

elif [ "$vmysql" = "True" ] 

then

echo "Mysql is set”

python $FPTH

else

echo “Django is set”

cd /dUsers/robertford/PycharmProjects/inference_engine2

python manage.py runserver

fi


This post has been edited by modi123_1: 31 March 2017 - 05:44 AM
Reason for edit:: fixed botched code tags


Is This A Good Question/Topic? 0
  • +

Replies To: build shortcut using Mac OS terminal

#2 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6563
  • View blog
  • Posts: 30,701
  • Joined: 10-May 07

Re: build shortcut using Mac OS terminal

Posted 31 March 2017 - 06:11 AM

Look at your if conditionals on lines 11, 15, 27, & 33. The first one has double equals, & the 2nd two both have single. I'm not familiar with which syntax is correct, as I use the dash options, for example : -eq -ne .
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1