Just to round off the day, I thought this might be of interest to someone other than me.
Personally, I hate editing a shell script and then writing it to disk, chmod'ing it and then running it. I know it's petty and not that big of a deal, but that's what shell scripting's for, right? Taking care of all those boring things you have to do over and over and over again.
This little script I call "vix" and I call it instead of "vi" or "vim" (Your preference; just modify the script - use emacs if you want ;) when I'm going to be writing a new executable script.
This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
# 2007 - Mike Golvach - firstname.lastname@example.org
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
/usr/bin/chmod 755 $@
Simple, right? $@ is just your command line arguments (the names of the scripts you're going to edit/write), so you can call:
vix scripta.sh scriptb.sh ...
vi scripta.sh scriptb.sh ...
and your script will be executable when you're done editing it. Silly and simplistic? Yes. Useful, too, if you're sick and tired of typing chmod 755 (or whatever) after every script you write :)
linux unix internet technology
Tuesday, October 30, 2007