views:

38

answers:

2

Well, the title says it all. Is it dangerous, insecure or not-so-smart for any other reason to put a custom shell script to /usr/bin and add /usr/bin to $PATH in order to make a custom script executable from everywhere without ./ and the file extension?

Bonus question: can I assign custom icons to custom executable scripts?

+3  A: 

Traditionally, /usr/bin is one of the places where operating system binaries are stored. For custom scripts, you'd use /usr/local/bin. This you have to create yourself if it does not exist and add to $PATH, as you mentioned.

Icons are a GUI thing, shell scripts are a CLI thing. They live in separate universes. Nothing prevents you from creating a bridge though. For instance, you can make a shell script and call it foo.command. Opening this from the GUI starts Terminal and runs the script. Since you see the file in the Finder, you can assign it a new icon through the Info pane.

Also, you may want to take a look at the free Platypus application. It allows you to create a full-blown application bundle around a script. The bundle will contain the script, so you won't have to put it in some obscure directory and modify $PATH. If you also need CLI access, this option is less desirable.

jackrabbit
"Opening this from the GUI starts Terminal and runs the script" . This what I just experienced :) . But I dont see where I can change the icon command+I did not help..
ran2
In the Get Info window, select the file's icon (near the top right), and paste in the image you want.
Gordon Davisson
You can select the icon in the command+I view and paste a new one over it. BTW: I could not find the link yesterday, but I've edited my post to mention Platypus. Have a look at it.
jackrabbit
+1  A: 

I wrote a command line tool for setting the custom icon of a file. You can grab it here.

regulus6633