Reputation: 2325
I am on a mac and want to make a batch script which runs a terminal commmand on double click.
I have found several of tutorials but all of them shows how to echo something?
What I want is to run this when I double click the script:
My-MacBook-Pro:platform-tools myname$ ./adb logcat -s Unity
I have saved this into a file called: mytest.command
When doubleclicking this I get this:
Last login: Wed Dec 17 09:26:04 on ttys001 My-MacBook-Pro:~ myname$ /Users/myname/Documents/mytest.command ; exit; /Users/myname/Documents/mytest.command: line 1: My-MacBook-Pro:platform-tools: command not found logout
How can I accomplish this?
Any help is appreciated
Upvotes: 0
Views: 113
Reputation: 207808
First, you need to know where you have installed adb
. If you know it is in /usr/local/bin
for example, then that is fine. However, if you don't know where it is installed, type
which adb
or
whereis adb
and it will tell you. Now, remove the word adb
from the answer you get, so you just have the path to the directory (folder) where adb
lives. Now you have the path, you can write your script:
#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:XXXXXXXX
adb logcat -s Unity
where XXXXXXX is the path to the folder where adb
lives.
Upvotes: 2