Adding Some Spice To *nix Shell Scripts
An anonymous reader writes "Developing GUI script-based applications is time-consuming and expensive. Most Unix-based scripts run in a CLI mode or over a secure ssh session. The Unix shells are quite sophisticated programming languages in their own right: they are easy to design and quick to build, but they are not user-friendly in the same way the Unix commands aren't (see the Unix haters books). Both Unix and bash provide features for writing user friendly scripts using various tools to build powerful, interactive, user-friendly scripts that run under the bash shell on Linux or Unix. What tools do you use that spice up your scripts on the Linux or Unix platforms?"
The shell is a poor clone of 1950's algol. Today, scripting in Ruby or Python yields scripts that can handle errors with advanced facilities like exceptions, and is more maintainable, and can connect to a number of different GUIs or the web.
Bruce Perens.
I agree python is lots of fun... but I do not call following script to be nontrivial.
> In Python, you can do things like
> junk_extension = (".temp", ".tmp", ".junk")
> if filename.endswith(junk_extension):
> os.remove(filename)
Your problem is: thinking ten lines of "if" statements to look at a filename.
This kind of things are done in 1 liner single shell command. This is too simple to bother python.
Please read about the "find" command. especially with --exec rm '{}' \;
Osamu
If you would get your facts straight there would be no need to flame.
OS X has been UNIX 03 (SuSv3) registered and POSIX compliant since 2007.
FYI, no version of Linux is registered Unix.
Read these and learn:
http://en.wikipedia.org/wiki/UNIX_03
http://images.apple.com/macosx/technology/docs/L416017A_UNIX_TB_FF.pdf
http://www.apple.com/server/macosx/technology/unix.html