A couple options
EDIT: I posted this in the wrong place, and cannot seem to remove it. But it's semi-relevant, so here it is.
One way to make a script an "Unix executable file" (with an icon that is the dark colored rectangular with '.exec' written on it) is to use 'cat' to get rid of the Apple file-type encoding. If you have a script called 'script.sh', and you rename it to 'script' with no extension, the file will continue to be identified as a '.sh' file, and thus will want to be opened with a text editor, unless of course you change the settings. But you can change the default application to Terminal by erasing the file-type info (with 'cat') and turning it into an executable file (with 'chmod'). The following script uses this method to change a file to an executable:
Code:
#!/bin/bash
# makeexec.sh
#
# changes the file type to "Unix executable file"
# by cat and chmod +x
if [ -z "$1" ]; then
echo usage: $0 directory
exit
fi
for var in "$@"
do
if [ -f $var ]; then
newname=${var%.*};
[B]cat $var > $newname
chmod +x $newname[/B]
fi
done
exit
The only problem with this method is that everytime you edit the executable, it wants to turn back into a .txt file. So, for this reason, I made this makeexec.sh script and put it in /usr/bin to speed up the process. I just do my edits, and then finish with a
Code:
makeexec.sh [I]file.sh[/I]
once I am done, which makes an executable file called
file.