Cool Mac OS X shell scripts?

d1taylor

Writer, et. al.
I'm seeking some way cool shell scripts that are specifically for Mac OS X. Anyone have one to nominate? And/or one they'd like to see? Thanks!!
 
I wrote one that pulls your IP address and prints it to a formatted HTML page and then uploads that to a server, automatically every 20 minutes. It's a simpler way to work around dynamic-DNS clients and stuff...
 
sudo periodic daily
sudo periodic weekly
sudo periodic monthly

Not really 'exciting', but maintenance is always important...
 
Thanks everyone. Here's what I have on my list of OSX scripts, so far:

Chapter 8. Mac OS X Hacks
#87 Renice a job by process name
#88 Start FTP/Apache from the command line
#89 New version of ?open? that searches for named apps
#90 iPod music list generator
#91 NetInfo friendly version of Adduser
#92 NetInfo friendly version of quota
#93 Parsing XML Data Files
#94 Emptying the Trash
#95 Backup Data to CDROM
#96 Time Spent Online

If any of those inspire other possible scripts, that'd be way cool. AeroPhool, I already have a "run routine cron jobs by hand" script earlier in my manuscript. :)
 
I am not in front of my CUBE but I'll try to pull some ideas from chemical memory.

There is a version of 'cat' that can accept input and spit it out via Apple speech routines. Source code available (pretty trivial). Many things can be greatly enhanced by this, MacOSX only. Can't remember where I did find it, you can do a google dig.

There is 'pipealert' (versiontracker or macupdate will also give info) that outputs its standard IO to a MacOSX Aqua alert box. Also many possible uses.

And of course, there are the 'osa'* utils that can greatly enhance your life via AppleScript magic. =)

(I suppose that you'll properly quote if you use any of these and other posts ideas in any book).

dani++
 
When I started writing code again I found that writing shell scripts for unix was very demanding of knowledge of not only unix sys admin but the C programming language .

You can write some crazy scripts .
 
Of the C programming language? An interesting comment. Were you stuck in the cursed C Shell, then? I personally am a fan of Bash, and give great kudos to Apple for adding it and giving a good alternative to the adequate, but not as capable zsh shell. [my opinion, your milage will unquestionably vary]
 
Here's my favorite. Actually, I just put it in my .bashrc file (~/.bashrc):
Code:
alias why="if [ \$RANDOM -gt 16384 ]; then echo 'because'; else echo 'why not'; fi"

So, next time you're ticked off at osx (or any unix) just ask it `why`. It will respond like a five-year-old. :p
 
cute. Of course, there's a whole series of these Unix jokes like "Got a match?' {type it in}.

In other news, the OSX chapter has been axed from my book as of this point. I continue to lobby, but there are other OSX-specific titles in the works. The good news is that almost every one of the other 90 scripts in my upcoming book work great in Jaguar, etc. :)
 
Back
Top