Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, iphone help, ipod help, AdSense, MySpace, Sony PSP help, Mp3 players, Windows XP, Windows Vista, Linux, SEO, Mac OS X, Facebook, Twitter and LinkedIn.

The box arrived from NoStarch Press and ...

It's official. Wicked Cool Shell Scripts is a real book. I have a copy in my hands right now, and another twenty or so on my shelf. My kudos to NoStarch Press for a job well done!

Dave's Answer: Curious about the topic? It's 101 great shell scripts for Unix, Linux and Mac OS X systems, each presented in its entirety with detailed explanations, sample input and output, and suggestions on ways you can hack it to go even further. Scripts range from Apache log file analysis tools to Web site scrapers, Mac OS X account management utilities to a version of the game hangman for your edification.

It's a good book. Check it out!



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

In script #7 under MacOS 10.2.8; I get a cut error:

[home:~/scripts] smac% valid-date november 25 1963
usage: cut -c list [file1 ...]
cut -f list [-s] [-d delim] [file ...]
usage: cut -c list [file1 ...]
cut -f list [-s] [-d delim] [file ...]
usage: cut -c list [file1 ...]
cut -f list [-s] [-d delim] [file ...]
valid-date: Unknown month name 25

It appears that its taking the second field for the month,
rather than the first. It fails on every date entered.

I've verified that normdate works properly:

[home:~/scripts] smac% normdate november 25 1963
Nov 25 1963

... and I freely admit that I'm a clueless puppy trying to learn scripting by doing.

Help? :)

smac

Posted by: Steve Macdonald at March 18, 2004 10:33 AM

As you reported to me in email, your problem was that you'd copied the cut statements like this:

month="$(echo $newdate | cut -d\ -f1)"
day="$(echo $newdate | cut -d\ -f2)"
year="$(echo $newdate | cut -d\ -f3)"

The problem is that you need TWO spaces after the backslash. Fix that, and it works fine. :-)

Posted by: Dave T. at March 19, 2004 11:57 PM

Am very interested in your book after seeing you on the Screen Savers last night (4/19/04). I tried the bestcompress script but it looks like I'm getting incorrect results. I'm running it on a 7767 txt file and it reports compress as the best choice resulting in a compressed file size of 4493. If however I run gzip and bzip2 on the txt file I get file sizes of 3715 and 3559 respectively. So it dosen't appear that compress is the best choice and bestcompress is not comparing the file sizes correctly. ???

Posted by: Dennis Brunskill at April 20, 2004 1:10 PM

Thanks for your note, Dennis. You're correct: it turns out that by default the ls command wants to sort filenames alphabetically, which turns out to be a problem with this particular script. The good news is that it's super easy to fix: instead of using "ls -l" in this script use "ls -lf" instead. There's a more detailed explanation on the main page of the booktalk weblog...

Posted by: Dave Taylor at April 25, 2004 11:32 PM


I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Uniblue: Free Virus Scan

Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Member of the B5Media Network

Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]