OSX Lion Dashboard Widget :: How to execute a shell script

I have this in my (first) OSX Lion Widget.

var test = widget.system("/Users/Me/testscript",null);

test.outputString is undefined, and test.errorString is sth. like this

DashboardClient[xxxxx:xxx] *** NSTask: Task create for path '/Users/Me/testscript' 
failed: 22, "Invalid argument". Terminating temporary process.

testcript contains only echo "here"

As far as I understand with google ... NSTask somehow ends my call, and it expects the actual binary executable. But is there a way to execute this bash - script -executable from the widget just as it is?

+3
source share
1 answer

In order for the shell to be invoked as a binary, the first line of the file requires "hashbang":

#!/bin/bash

which tells the OS which interpreter to use for the script. Without it, the OS will get confused about what to do with the file, giving you the error you saw.

+4
source

All Articles