![]() |
Why is shell script programming so fun?Dave, can you tell me, how come I enjoy shell programming more than other types of programming (Javascript, Java or C)? Well that's an interesting question! I've programmed in dozens of languages, ranging from the classics (BASIC, Algol, Fortran, Pascal) to more modern languages and even obscure ones (Ada, APL) and I have to agree with you, Scott, that there's something about shell script programming in the Linux environment that's easy, fast, and great fun. I think part of it is that since it's incredibly easy to access regular Linux commands from within a shell script, it's one of the few languages where you start out already knowing how to do the complicated things from just using the command line. Want to find out the hostname of the computer? Just use "hostname" as you would on the command line. Want to assign it to a variable? Easy: host=$(hostname)
(or you can use the older notation of `hostname` if you'd prefer) There's also almost no overhead, no declarations, no need to define variables in advance, so you can write shell scripts as short as one line: who | grep mary
Since it's an interpreted language rather than a compiled one, it's also really fast to work with and your development cycle is edit -> run -> edit -> run until you get it to work as you desire. Even better, as you learn more about Linux or add additional command packages like ImageMagick to your system, you gain lots more control and capabilities in your programming environment too. I've always referred to shell script programming as "lightweight" because it's really fast to get started, easy to use, and perfect for short apps and prototyping. Would I write a compiler as a shell script, or a GUI system? No, I think that'd be a huge amount of work and is going to be a pain in the booty. But would I write games, system utilities, and useful little 'bots as shell scripts? Heck yeah, I have a whole book about it: Wicked Cool Shell Scripts. Now, the honest other side of the coin: there are no debugging capabilities in the shell to speak of, and since you can do any command, you can also make grievous mistakes without it complaining, like deleting the file you're trying to parse. So it's not all milk and honey, proverbially or otherwise. Still, if you have a Mac OS X system or a Linux box, you might well want to spend some time playing on the command line, then jump in to writing a few short, simple shell scripts. You'll be amazed how little like programming it feels and how much faster and more fun it is than writing complicated C++ or Ruby functions!
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon
Categorized:
Shell Script Programming
(Article 9339)
Tagged: ada, algol, c++, fortran, linux, mac os x, pascal, perl, programming, shell scripts Previous: How do I delete my Google Gmail account? Next: How Can I Comment On My Facebook Fan Page As Myself? View Mobile Version Subscribe!
Dave, I have to agree with you....I've dabbled in Cobol, Fortran, PL1 and RPG before "discovering" UNIX shell scripting in 1995. I've moved into Linux and still really enjoy it. Posted by: Gary the K at March 9, 2010 8:18 AMI have something to say, now that you mention it, but ...
I do have a comment, now that you mention it!
|
Recommended
Recent Entries
Search
I Need Help!
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above Facebook Help HTML and CSS Industry News and Trade Shows Mac OS X Help MySpace, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help |