Slashdot Log In
Wicked Cool Shell Scripts
from the words-that-do-stuff dept.
| Wicked Cool Shell Scripts - 101 Scripts for Linux, Mac OS X, and UNIX Systems | |
| author | Dave Taylor |
| pages | 368 |
| publisher | No Starch Press |
| rating | 10 |
| reviewer | Mary Norbury-Glaser |
| ISBN | 1593270127 |
| summary | 101 Scripts for Linux, Mac OS X, and UNIX Systems |
Chapters are divided into an array of topics sure to catch the attention of any UNIX based system user: The Missing Code Library, Improving on User Commands, Creating Utilities, Tweaking Unix, System Administration: Managing Users, System Administration: System Maintenance, Web and Internet Users, Webmaster Hacks, Web and Internet Administration, Internet Server Administration, Mac OS X Scripts, and Shell Script Fun and Games.
In true "cookbook" fashion, each hack is numbered and divided into The Code, How It Works, Running the Script, The Results and Hacking the Script. Throughout, the author clearly describes the syntax and functionality of each script, often with additional notes in How It Works detailing the syntax process and interesting asides. But Hacking the Script is what gives Wicked Cool Shell Scripts true value; where applicable, the author uses this section to describe script modifications to achieve a variety of alternative real world, practical results. This additional section alone easily triples the total number of scripts the reader is exposed to.
This book enables the reader to get "up close and personal" with their UNIX based system and explore the possibilities afforded by becoming intimate with the command line interface. The reader will find themselves easily propelled into the world of scripting, thanks entirely to Dave Taylor's ability to take what some might describe as a fairly dry topic and translate it into a logical and user friendly construct. Just reading through the table of contents is inspiring and intriguing; did you know you could write a script to retrieve movie info from IMDb? or track the value of your stock portfolio? or that you can use a very simple script to check spelling on your web pages?
Sysadmins and webmasters will find this book fundamentally critical to day-to-day operations; there are dozens of invaluable, customizable scripts highlighted in this book to enable professionals to save time and add simple, elegant solutions to annoying issues in their work environment. User account management, rotating log files, cron scripts, web page tweaks, apache passwords, synchronizing via ftp, etc. are all eminently useful and tweakable.
Geeky home users will discover they can use these scripts to work with files and directories, create spell-checking utilities, calculate loan payments, create summary listings of their iTunes libraries, and of course, play games. Many of the sysadmin scripts would also be of interest to the power user: analyzing disk usage, killing processes by name and backing up directories, to name a few. Both types of users will find this book inspiring and truly fun!
One of the secret pleasures of a technical book reviewer is finding those wonky bits of code that suffer from misplaced or missing punctuation, misspelled words and other basic typographic errors inherent in the book publishing process. I randomly selected many of these scripts to try out in the process of doing this review and...dang, haven't found any errata yet. But be sure to check out the errata page on Dave Taylor's web site for any that more astute readers may find (there were none, as of this writing).
Also be sure to take a closer look at Dave's shell script library, which lists additional scripts that didn't make the cut for the book. As convenient as it is to download the entire script library, I would like to stress the value of buying the book, which will provide you with invaluable instruction and guidance in understanding the syntax of the scripts and it also illustrates how making small but significant tweaks can modify the output to match your specific needs.
(A special nod of appreciation to Dave Taylor's Tintin references!)
You can purchase Wicked Cool Shell Scripts - 101 Scripts for Linux, Mac OS X, and UNIX Systems from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
What about us Windows users?! (Score:4, Funny)
Re:What about us Windows users?! (Score:5, Informative)
(Last Journal: Friday March 03 2006, @04:00PM)
Re:What about us Windows users?! (Score:5, Funny)
(http://slashdot.org/)
Re:What about us Windows users?! (Score:5, Funny)
(http://rlrr.drum-corps.net/ | Last Journal: Saturday April 14 2007, @06:52PM)
Re:What about us Windows users?! (Score:4, Interesting)
(http://www.morpheussoftware.net/)
C:\> sh.exe myscript.sh
MinGW (Score:4, Informative)
The latest version of sh.exe is 465k bytes, it sounds like you have an old version. You should upgrade it. :)
Re:What about us Windows users?! (Score:5, Informative)
(http://alfter.us/ | Last Journal: Wednesday October 03, @01:50PM)
Cygwin [cygwin.com] is your friend. For just one example, you can write a script that uses sed to extract information from the filenames of your mp3z and feed the results into id3ed to tack on an ID3 tag. Try doing that with a batch file.
Re:What about us Windows users?! (Score:5, Informative)
(http://www.daishar.com/blog)
That's true, but the fallacy is that you're assuming Windows should be scripted in the same fashion as *nix. That's simply not the case. Batch/Command scripting is nice for small bits, and can actually be fairly powerful in an obtuse sort of way, but the real power in automating Windows comes by using the Windows Scripting Host, JScript or VBScript, and all of the ActiveX/COM interfaces into the functionality of the OS and other applications. A classic example is iterating through users. In *nix, you write a shell script to parse through /etc/passwd. In Windows, you write a jscript to instantiate the objects that deal with Active Directory, and iterate through user objects (each of which you can perform actions upon, wherein *nix you'd have to invoke other applications). One approach is not necessarily "better" than the other, but you can't assume that your *nix administration experience will directly translate into Windows administration. You'd laugh if a Windows admin felt the reverse was true. What really gets me is when people complain about Windows not being automation-friendly because they're used to *nix scripting. Yes, you cannot pipe notepad.exe into winword.exe, for example, but Word has a very rich automation interface that you can hook into and use from a simple JScript.
What? Try running "help del" from a cmd.exe window some time. Also, look at "help rd". If you want to remove a directory tree, you use the "remove directory" command. "del" deletes files. "rd" deletes directories (and can delete files within directories if you tell it to).
Consider cmd.exe to be the functional equivalent of csh. It's a decent interactive shell, and has some good functionality (especially later versions of cmd.exe in win2k and xp), but you'd have to be nuts to do any extensive scripting with it. Just as you'd pull out bash or perl to do more complex tasks in *nix rather than using csh, you should use WSH in Windows for more complicated tasks.
Re:Is that a recipe for bloat? (Score:5, Informative)
(http://slashdot.org/ | Last Journal: Friday November 16, @12:15AM)
The trick with Windows is that you can do many of these same things, but this power comes from doing it in WSH or VB (or C/C++ or an ASP or whatever language you're comfortable with. I've even done it in Perl.) You use the COM interfaces of the shell object to enumerate through directory trees and files. You can stream each of those files into the COM interface of another program that accepts streams. You can search, you can pipe stuff all over, and you're not limited to a single instance of stdin, stdout and/or stderr.
It's not unlike shell scripting, it's just a different language. Each application is able to expose whatever it feels is most important in whatever fashion it thinks is best. DevStudio, for example, lets the scripting host user get to the workspace, the project, and any of the tools.
The biggest problem I have with it is that stdio is not "guaranteed" to be supported by every application under Windows. stdio is the glue that binds all the UNIX utilities together. That's the beauty of stdio -- as the sole mechanism for I/O for most tools, it became the defacto application interaction interface. Windows doesn't have that: most Windows apps don't offer any automated IO at all. And some of the ones that do seem to have interfaces pasted on after the fact. But the ones that do expose properties and methods via COM are easy to access, and easy to control from anywhere. And using the interfaces tends to remove the ambiguities: in UNIX if you're using 'cut' to parse a phone list but the name field sometimes contains commas, you end up hacking around solutions to make them work. A COM-based solution would provide an interface containing a Name field.
Windows is not alone in this limiation, either. UNIX suffers from a similar problem: how do you meaningfully pipe data to and from an X window, or even to a curses app? Is it consistent between apps? Most apps I am familiar with that offer such features in their applications had to have code added to actively support a meaningful commandline interface to their programs through the use of dozens of command line switches. Without this sort of code, using stdio to parse the output of a curses-based application becomes a tedium of screen scraping.
Don't get me wrong: I have a bevy of UNIX-like command line utilities for Windows, I use Cygwin and bash when I need to (although the file system mapping is worse than I could have imagined), and I will fire up a CMD script long before I think to write it as a VB or C++ program. I'm far more comfortable with the sh-style tools -- I grew up with them.
I'm not saying stdio is better or worse than using the COM interfaces of Windows; I'm just saying it's "different." And you certainly shouldn't be reinventing the wheel to script up utilities in Windows.
Re:What about us Windows users?! (Score:5, Funny)
Re:What about us Windows users?! (Score:4, Funny)
(http://www.infiltrated.net/ | Last Journal: Monday February 16 2004, @01:07AM)
grep "+-"|\
sed 's/\\//g;s/\//
awk '{print $2,$3,$4,$5}'|\
sed 's/
Woo (Score:4, Funny)
(Last Journal: Thursday August 26 2004, @08:46PM)
*Bookmarks this page for when I get money*
the best shell script (Score:3, Funny)
(http://www.donnyspi.com/)
rm -rf *
Re:the best shell script (Score:5, Funny)
(http://www.junkbuster.com/)
A better idea is to write "rm -rf ~/*", name the script "ls" and put it in your home directory to punish people with "." in $PATH . Now _that's_ teh funnay.
Re:the best shell script (Score:4, Funny)
One of the reasons I love unix, is that it will let you shoot yourself in the foot, and it will steady the gun while you take aim at your toe.
sounds cool (Score:5, Interesting)
(Last Journal: Monday February 16 2004, @11:20AM)
Re:sounds cool (Score:4, Insightful)
(http://slashdot.org/)
Usage guide found on page one. (Score:5, Funny)
Step 2. Type 'chmod a+x
Sounds useful, but what languages are used? (Score:1, Funny)
(Last Journal: Sunday October 10 2004, @02:36PM)
Re:Sounds useful, but what languages are used? (Score:4, Insightful)
(http://aol.com/)
The programming languages like C, C++, Java etc, are strongly typed languages and the compiler will give you sufficient information to correct your incorrect syntax problems.
So even when you switch from say C++ and Java, with a little common sense and reading the compiler errors and warnings you can easily pick up java syntax, keywords etc.
But with scripting languages it is not so, as they are not compiled. This is especially a headache when you are dealing with multiple unix machines having differnet shells.
I once worked at a job where I had to use , csh (c-shell) , sh (original bourn shell) , ksh ( korn shell ) and bash (bourn shell ) on different linux, solaris and HP-UX boxes. It was a real headache maintaining the scripts.
All these scripts differ quite a lot in syntax , especially for arethmatic, redirects , invoking sub shells , comparision operators etc.
What is needed is a good shell cross referencing manaul which will provide comparative features of at least the major shells like , bash , sh, ksh, csh, tcsh , zsh.
Hmm. (Score:5, Funny)
Please please tell me it's not
#!/bin/sh
wget 'http://imdb.com/title/tt0151804/'
http://imdb.com/robots.txt (Score:5, Informative)
Re:Hmm. (Score:5, Funny)
Why shell? (Score:3, Flamebait)
(http://cretin.sf.net/)
Re:Why shell? (Score:5, Funny)
Re:Why shell? (Score:5, Insightful)
During boot up scripts, until you get past the point that /usr is mounted (you do put /usr on a different partition right?), you can't use anything. That's how you determine what goes on /bin and what goes in /usr/bin (well mostly). When things go wrong, and you need to recover, trying to fix things on a busted machine, is much more reliable if you are using shell then perl (it's got a smaller foot print, and it's not an intertangled mess of libraries).
Intertangled messes of libraries are a great thing when you are developing. They are a beast, if things are broken. What if you fsck can't finish because part of the library is dorked. Thus you can't mount the filesystems you need to use to fix the problem.
During boot up, you want to use the easiest, and most reliable method of booting. Shell scripts are probably better off then perl scripts. It's easy to have readable, reliable shell scripts with scoping, it's just not something you are used to doing apparently.
Besides all that, you'd spend all your time in perl doing exec/fork/system. The /bin/sh is more efficient at doing that then perl is (in terms of code, if not runtime).
Kirby
Re:Why shell? (Score:5, Interesting)
(http://www.perlworks.com/ | Last Journal: Monday January 06 2003, @05:06PM)
Libraries other than the standard set of libraries are not be required for doing the simple tasks that shell scripts often do. I am sure the entire functionality of bash is well within the core of Perl.
It's easy to have readable, reliable shell scripts with scoping, it's just not something you are used to doing apparently.
No I admit I do very little in shell scripting mainly because I do not see the need. Perl supports many many features that ease program and script development.
Also perl has builtins like open, readdir, socket, etc. In shell programming would you not have to do things like `cat file` to read file? Does this not increase the overhead of shell scripts by forking another shell?
Eventhough my original post was mod'd flamebait it is not just a curious enquiry.
Re:Why shell? (Score:5, Informative)
(http://naikrovek.org/)
why not dynamically compiled? Well if your glibc barfs all dynamically compiled binaries barf with it - including perl, and including any shells that you use to start up your system. With a statically compiled shell to handle all of those startup scripts you can boot linux without glibc working, and you probably have enough of a system still running to get things fixed. with a dynamically linked startup file interpreter, when glibc or something glibc depends on goes, your whole system goes, single-user mode and all.
Besides, while perl can execute system commands and make decisions based on input, i think the shell is a better tool for things like this. sh and bash were designed to do startup scripts (among other things) and they do them well. why fix what isn't broken? shell scripts work, and they can do anything you'd need them to do during startup.
Re:Why shell? (Score:5, Informative)
(i) Many people, like myself, don't know perl, and don't see the point in learning when shell scripts are perfectly adequate for their purposes.
(ii) Sometimes it's just easier. viz. this quote [bash.org] from bash.org:
Re:Why shell? (Score:4, Interesting)
(Last Journal: Friday August 02 2002, @06:46PM)
Recently I had a 4 line script that helped me reconfigure a bunch of workstations. He wanted in redone in perl, so a 4 line hack became a 50 line perl script.
Re:Why shell? (Score:4, Interesting)
(http://www.perlworks.com/ | Last Journal: Monday January 06 2003, @05:06PM)
Show me a shell script that takes more lines of code to do the same job in Perl. Perl has many more features like grep, map, hashes, , symbolic references, etc. that make short work of simple tasks that do not exist in shell.
More likely the reduction of lines of code would be converting from shell to perl.
I bet your boss know shell and Perl and has (in my humble opinion) make the right choice in standardization.
I would recommend that you spend a little time with Perl (or python or ruby) and bet you would change your mind in short time.
When the only tool you have is a hammer... (Score:5, Insightful)
(http://www.mwatt.com/index.html | Last Journal: Friday February 11 2005, @02:43PM)
Actually, I agree that shell scripting is a powerful tool and well worth understanding. But 'a loan calculator' script? Gee, once you know the formula, a coupla minutes in a spreadsheet will do the trick.
I guess all people, myself included, fall into the hammer/nail trap. I know C very well, so I use it for just about every little app. Hmm... maybe I oughta buy this book.
-RatOmeter
Re:When the only tool you have is a hammer... (Score:4, Insightful)
(http://unixbob.blogsome.com/)
Hmm... (Score:5, Funny)
(http://is.gd/)
Hopefully it also features a grammar checking script to ensure that you don't start using phrases like 'Wicked Cool'.
Re:Hmm... (Score:5, Funny)
Re:Hmm... (Score:5, Funny)
(http://slashdot.org/)
#/bin/shizle -yo
#declare a gangsta (variable) called slim
I'm a big ass gangsta and my name is slim
#link in the math pimp (library)
math pimp is in tow and don't you fsck with him
#initialize slim to the hos (linked list) 4,3,2,1
# this causes an error because there is no rhyme
4 and 3 and 2 and 1 now slim and his hos be comming for you
#open a shoutout (file)
Yo, here's a shoutout to the users out there
hey Andy (CR LF)
hey Amy (CR LF)
hey Ben (CR LF)
hey Zack (CR LF)
#exit with no error code
peace out
%
errah
Re:Hmm... (Score:4, Funny)
(http://igogg.com/ | Last Journal: Thursday October 31 2002, @10:26AM)
Wore that shirt to my parents one time and my mom didn't exactly get it. Unix does not equal Eunuchs. Try explaining that to your mom.
101 Prompts? (Score:5, Interesting)
Re:101 Prompts? (Score:5, Informative)
(http://www.hamonicamundi.org/nds)
I don't know if such a book (or chapter in a book) exists, but here are some links:
Have fun...
Webmasters?? (Score:3, Insightful)
(Last Journal: Wednesday August 18 2004, @07:52AM)
What webmaster uses SHELL scripts?!
I understand, PHP, Perl, some other CGI. Marginal use for scripts for log analysis, maybe some file management, making their own work a bit easier.
But shells were never meant to do any web work. They are too slow, too heavyweight, too vulnerable to abuse by malicious users to be used as server side extensions!
Re:Webmasters?? (Score:5, Interesting)
(http://www.lumenera.com/)
Um, me.
My web server has 6 megs of RAM. (it's an embedded device). That gives me two choices: C or sh. Obviously sh doesn't work for everything, but it's sure a heck of a lot nicer than using C for the non-critical stuff.
Ironically, I usually use Python for administration type tasks during development on real computers, and sh for the web sites themselves on the embedded servers.
Bryan
Quick Hacks (Score:5, Informative)
(http://aol.com/)
If the script is not working as you want, put a
on the fist line and on the last line.You will see the exact execution path and variable expansion, very neat for debugging
Re:Quick Hacks (Score:5, Informative)
sh -x scriptname
killing processes by name... (Score:1, Insightful)
Solaris has killall (Score:4, Insightful)
shell scripts vs. programming languages... (Score:5, Interesting)
(http://www.lazylightning.org/)
Why would you use awk and sed along with a really ugly shell script to get something done when you could have just as easily used perl to acheive the same effect?
Sometimes you should just use what is best for the job. I really don't think that using shell scripts to pull IMDB movie info is the best way to go.
YMMV,
Re:shell scripts vs. programming languages... (Score:5, Informative)
(http://home.comcast.net/~rickrich1/)
Well, I think Silent Bob (garcia) is directly attacking me as the author of these fine tools: Linux tools for geocaching [rkkda.com]
I do know Perl as well as all of the original Unix tools: awk, sed, and of course my favorite: shell.
The short and main explanation is that shell/awk/sed lend themselves very well to what is known as the "Unix tools" approach. Its a way of thinking using a small set of core tools that pays big rewards in productivity.
In the case of my geocaching tools, two things were plainly obvious to me at the start. 1) I would be scraping the pages with curl, because there is no better and easier tool for that job, and 2) gpsbabel would be a main part of almost every tool because it knows how to work with a bajillion waypoint formats. So the onl;y question after that is which language to use to glue those commands together. Shell, awk, and perl can all do that. I used shell to tie it all together because that is what shell is best at.
In a few of the tools, geo-map in particular, I did make a mistake in the glue choice. My excuse there is that it evolved far beyond its original design goals. So it ended up requiring a lot of floating point calculations and therefore I had to run several mini-awk scripts within it. If I were to rewrite it today, I would make it a pure AWK script. Why not perl? Because, IMHO, awk has the cleanest syntax of any of the scripting languages.
So, then, when *would* I use perl? In general, I select perl when 1) there is a pre-written module that does a job that would be hard to do with shell/awk/sed, and 2) the use of that module is truly necessary. That second point is very important to me. The mere existance of a Perl module does not necessarily mean its the best or fastest way to solve the problem.
Perl was the language of choice for "Belle", which is a 4000 line IRC robot I coauthored for use in my daytrading activities. The IRC module was what tipped the scale for Perl in that case.
Another problem with perl modules is that using them guarantees that you will lose some percentage of potential users of your program. Having to find and install additional packages puts many people off. I try to make my scripts completely self-contained (including usage doco) so that people don't have to go thru these hassles.
Anyway, you can argue with any of my points, but what you can't argue with is that I have the largest set of command line tools for geocaching that work, regardless what my language choice was.
-Rick
A very cool shell script (Score:5, Funny)
(http://plato.stanford.edu/ | Last Journal: Tuesday March 15 2005, @10:46AM)
Tintin and Asterix! (Score:4, Interesting)
(http://slashdot.org/~GillBates0 | Last Journal: Tuesday July 10, @04:36PM)
And a special nod of appreciation to norburym for mentioning the Tintin references in the review!
It was cool to see a reference to one of my favorite fiction/comic books on Slashdot. I hate to call Tintin and Asterix comic books because they're so much more than mere comics. I've noticed though, that not many people are as hooked to the Tintin and Asterix series in the US as in Europe/Asia. They're great for kids and much *much* better than the shitload of comics that they read nowadays.
I've had trouble finding them in the public libraries (in 3 states) and even the big book stores. So people who haven't heard/read these books, are definetly missing out on some cool reading. Check them out at your local library or atleast their websites: Tintin [tintin.be] and Asterix [asterix.tm.fr].
Note: I am in no way affiliated to these books/publishers/websites. I'm just an avid fan :)
Ummm... (Score:4, Funny)
(http://slashdot.org/)
Coulda done with this about 2-3 years ago... (Score:1, Interesting)
John
Cliff-Hanger spoiler... :D (Score:3, Funny)
But does it have... (Score:3, Funny)
(http://arc.nucapt.northwestern.edu/F/OSS)
Yeah right. A "cool" shell script. (Score:2, Funny)
-- scsg
Is there a shell script to... (Score:5, Funny)
(http://www.geocities.com/critter_75075/)
Is there a shell script included that makes it look like you are working? Isn't that the purpose of all good shell scripts?
Freedom is trouble :)
dated title (Score:3, Interesting)
pushd and popd (and other tricks) (Score:5, Informative)
(http://slashdot.org/)
Here's other stuff I have grouped by sections in my .cshrc
First, I have my shell variables. The comments say what they do. The most important one is autolist.
Second, bindkeys are pretty neat. I rebind the up and down arrow keys. By default they scroll up and down one at a time through the history. You can bind them to search the history based on what you've typed so far.
Third, completes allow for customizing tab completion. When I change directories, tab only completes directory names. This also works for aliases, sets, setenvs, etc.
Fourth, I have all my aliases. I had to cut a bunch because of the lameness filter.
Really??? (Score:5, Funny)
Quick! Somebody pick this up for Taco!
will this book become free (Score:1)
Hmmm (Score:3, Funny)
(http://www.iola.dk/)
This might be because it's
Book Recommendation (Score:5, Informative)
(http://watson-wilson.ca/)
Cool scripts (Score:4, Informative)
Very small shell script (Score:2, Funny)
(http://foxwoodent.com/)
My favourite shell script... (Score:3, Informative)
(http://www.daemonology.net/)
My personal favorite; (Score:5, Interesting)
Do *not* run this on your production servers.
Re:My personal favorite; (Score:4, Informative)
(http://davidmorgan.org/)
It reads... define function ':' as follows: pipe the output from function ':' into function ':' -- do that in the background (ie fork). Call the function ':'.
I had no idea how it worked, either, but I looked it up
Here's one wicked cool shell script (Score:2)
#!/bin/sh
# cool.sh: do some cool stuffs
A DynDNS.org client would be a cool shell script (Score:2)
(Last Journal: Wednesday June 22 2005, @11:11AM)
And yes, I already have installed an ethernet card and I have telnet access (locally only). The goal is to always have TiVo Web Plus access (via a non-standard port and password protection) anytime, anywhere.
So, has anyone written a client like this? I think TiVo has a bash client (it runs on Linux, of course). Thanks.
Bookpool.com has this on sale (Score:1)
My Favorite Script (Score:1)
Stupid question - sed on binary files (Score:2)
I recently wrote a small script to fix bad dates in a camera RAW file. It was all
Now while the script worked fine, and replaced what I wanted, in the end the output was one character longer than the original file - Sed has appended a newline at the end of the file. When I deleted this trailing character the file was fine.
This was on OS X, I don't know if that sed is just crazy or what. Does anyone know how I could have NOT have sed add this char, or remove it after it was there? At the time, the only way I could think to remove the char was to use sed which I did not try for obvious reasons! I thought about using Awk instead but figured I would run into the same issue (perhaps I would not have).
Perhaps this was a case where perl would have been better, but I wrote the script in about ten minutes and I really don't know perl at all.
cd with history (Score:5, Informative)
(http://home.comcast.net/~rickrich1/)
The shell helper that I am totally lost without is one that adds directory history to bash and ksh. You can find it here: _cd [rr.com]
I guess I never really got the idea of a stack of dirs being useful, since I seem to bounce around more at random than anything else. I prefer to have a cache of places I've recently been.
Bonus puzzle for slashdot readers: using the cd with history function, what directory is this command likely to take me to?
A little disappointed, actually (Score:2, Interesting)
Don't get me wrong, the scripts seem good enough, nd the lack of errata is commendable. But I don't want a loan calculator, weather tracker, or datebook: those seem like _applications_ to me, not scripts for system administration (as the book claims it contains).
Anyway, I'll try some of them out on my iMac and my Solaris systems, but this won't be making that big move out of the bookshelf onto the desk, if you know what I mean.
shell scripts still useful. (Score:3, Interesting)
(Last Journal: Friday November 16, @09:48AM)
I work for a large company (50,000 employees), and the directory lookup site of choice is driven behind-the-scenes by about 6,000 lines of shell script (bourne). Having written this application, one of the most common back-handed compliments I get is when users ask what I did to optimize this application to make it SO FAST! I just smile.
(btw, this lookup tool does more than simple fill-in-the-blank lookups -- it has a first-name-alias lookaside table (so I can find "Sue", even though she's in the database as "Susan", it is case insensitive (yawn), order insenstive, field insensitive (there's only ONE input box), and more than returning just the phone number of the employee, it draws the entire hierarchy around the employee (direct reports, peers, management chain). And, there are buttons for each person on the page to: send page; send e-mail; generate and org chart..., and much much more)
Don't mean to make it sound like an ad for the application -- just thought it might be reassuring to other shell programmers that a shell script can be a major corporation's tool.
The *free* guide to Bash shell scripting (Score:5, Informative)
From the site:
This tutorial assumes no previous knowledge of scripting or programming, but progresses rapidly toward an intermediate/advanced level of instruction (...all the while sneaking in little snippets of UNIX wisdom and lore). It serves as a textbook, a manual for self-study, and a reference and source of knowledge on shell scripting techniques. The exercises and heavily-commented examples invite active reader participation, under the premise that the only way to really learn scripting is to write scripts.
is there a small shell script.. (Score:1)
You can convert awk to C (Score:2, Informative)
The performance improvement was about 6-7X on my project.
awka [freshmeat.net] does that.
On my project it took less time to convert the awk to C, gcc the C and run the binary than it did to run the perl version.
This is not a perl flame. I am old. I use awk.
Laid off haiku (Score:3, Funny)
I can't wait... (Score:2)
Bah (Score:1)
Ever seen what a deep cycle battery and a pair of jumper cables can do to a wire hutch at the end of the block? Don't need to know squat about sed and awk for that ammount of fun
unix tips site (Score:2)
(http://www.boogle.com/)
A couple I use everyday... (Score:3, Interesting)
(http://pengsheep.org/ | Last Journal: Saturday August 14 2004, @12:02AM)
this is my favourite bash function, psgrep()
ps aux | grep $1 | grep -v grepAnd my favourite script, cls:
#!/bin/sh
echo -e 'ESC[c'
wicked good or wicked bad? (Score:2)
(http://www.pixelbeat.org/)
there that I would find particularly
useful or that the logic isn't already elsewhere.
Here's my personal collection of
command line tips [pixelbeat.org] and
scripts [pixelbeat.org]
Re:Doing things yourself (Score:5, Insightful)
So what? I just bought a cookbook on sauces. What's different? Maybe I like a little more garlic in most my sauces so I'll throw some in here and there. Most of the sauce recipes, i would have never have thought to go with something I usually eat. Why does there need to be a "challenge"? It simply makes my meal more enjoyable.
Having 101 shell scripts that I can tinker with and add things that I like, or use them in a way that makes using my computer more enjoyable is great!
Re:Exactly... (Score:2)
(http://www.jenkatgames.com/ | Last Journal: Sunday September 07 2003, @03:00AM)
Re:Doing things yourself (Score:2, Insightful)
--
There's nothing like a good AC reply on Slashdot... and this was nothing like a good AC reply.