I am having trouble with simple shell scripts and LaunchBar. I am running 5.6.4 for the time being, as version 6 has been problematic for me and I have not had time to do a fully and wholly clean install.
When I make a shell script that does something, say it is called "foo" and I hit command-space then type foo to get to it and run it, lets say it needs root privs, how does that all play into LB? When, where, and how would LB ask for a password?
For example, I have a script that calls out to the command `tmutil` which I believe needs sudo/root permissions to run a backup. I took this and put it into a file that is in the Actions folder and it works though:
#!/bin/bash
/usr/bin/tmutil startbackup
What should the permissions on the actual file be?
And here is where I am getting stuck, mainly in that the results are not reliably consistent.
I use a keyboard macro ( Keyboard Maestro ) to run a shell script that is a formatted date command, so at any time I can just type "./date" and it will type out 08/18/14 — 08:15:15 AM ( don't be confused by the ./date, I know it looks like you are calling to run a command, but it is just a string, I could set Keyboard Maestro to fire on */date too, that is just an easy one for me to type and I get the date and time in a format that I want, like this: 08/19/14 — 01:54:19 PM
I have started to play with making it a snippet, but I still would like to learn what in the heck is going on here. I should be able to get this to work.
I made a simple shell script, and will call it via LB when I need it, but it doesn't work and I can't find a log that mentions why.
Here is where I am working:
$pwd
/Users/me/Library/Application Support/LaunchBar/Actions
I opened it up to chmod 777 as a test:
$ls -la mydate
-rwxrwxrwx@ 1 me staff 94 Aug 18 03:21 my date
I can run on from the command line:
$./mydate
08/18/14 — 08:18:32 AM
Works fine. Here is all there is to it:
$cat mydate | pbcopy
#!/bin/bash
# shows the date formatted as 08/18/14 — 03:20:42 AM
echo $(date "+%D — %r")
Here is a screenshot of it in the index:
http://dl.dropbox.com/u/340087/drops/08 ... 082021.png
Oh I did figure out the snippet syntax, but I still want to learn how to get shell scripts to reliably run. They are too valuable, especially since they can accept input arguments as well. Here is the same as my shell script but as a snippet:
<date MM/dd/yy> — <time hh:mm:ss a><|>
I think I need to know where LB logs to, that may shed some light on things. I bet it is permissions, and somewhere LB is trying to run the command, and it is saying, sorry, you don't have permission to do that. That's just a guess though, as running `date` should not need any permissions at all, it is pretty darn benign.
Thank you!
When I make a shell script that does something, say it is called "foo" and I hit command-space then type foo to get to it and run it, lets say it needs root privs, how does that all play into LB? When, where, and how would LB ask for a password?
For example, I have a script that calls out to the command `tmutil` which I believe needs sudo/root permissions to run a backup. I took this and put it into a file that is in the Actions folder and it works though:
#!/bin/bash
/usr/bin/tmutil startbackup
What should the permissions on the actual file be?
And here is where I am getting stuck, mainly in that the results are not reliably consistent.
I use a keyboard macro ( Keyboard Maestro ) to run a shell script that is a formatted date command, so at any time I can just type "./date" and it will type out 08/18/14 — 08:15:15 AM ( don't be confused by the ./date, I know it looks like you are calling to run a command, but it is just a string, I could set Keyboard Maestro to fire on */date too, that is just an easy one for me to type and I get the date and time in a format that I want, like this: 08/19/14 — 01:54:19 PM
I have started to play with making it a snippet, but I still would like to learn what in the heck is going on here. I should be able to get this to work.
I made a simple shell script, and will call it via LB when I need it, but it doesn't work and I can't find a log that mentions why.
Here is where I am working:
$pwd
/Users/me/Library/Application Support/LaunchBar/Actions
I opened it up to chmod 777 as a test:
$ls -la mydate
-rwxrwxrwx@ 1 me staff 94 Aug 18 03:21 my date
I can run on from the command line:
$./mydate
08/18/14 — 08:18:32 AM
Works fine. Here is all there is to it:
$cat mydate | pbcopy
#!/bin/bash
# shows the date formatted as 08/18/14 — 03:20:42 AM
echo $(date "+%D — %r")
Here is a screenshot of it in the index:
http://dl.dropbox.com/u/340087/drops/08 ... 082021.png
Oh I did figure out the snippet syntax, but I still want to learn how to get shell scripts to reliably run. They are too valuable, especially since they can accept input arguments as well. Here is the same as my shell script but as a snippet:
<date MM/dd/yy> — <time hh:mm:ss a><|>
I think I need to know where LB logs to, that may shed some light on things. I bet it is permissions, and somewhere LB is trying to run the command, and it is saying, sorry, you don't have permission to do that. That's just a guess though, as running `date` should not need any permissions at all, it is pretty darn benign.
Thank you!