Linux Today: Linux News On Internet Time.
Search Linux Today
search.internet.com
Linux News Sections:  Blog -  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Preferences
Contribute
Link to Us
Search
Linux Jobs

Become a Marketplace Partner

internet.commerce
Be a Commerce Partner














The Linux Channel at internet.com
Linux Today
Enterprise Linux Today
Apache Today
JustLinux.com
Linux Planet
PHPBuilder
All Linux Devices
Technology Jobs

JustTechJobs.com

LinuxToday Newsletters
Subscribe News
Subscribe PR
Subscribe Security

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

 







Current Newswire:

Intel Linux Graphics Shine With Fedora 12

Editor's Note: Do It Yourself "Cloud"

Google Chrome OS: First looks, first impressions

Kernel Log: Coming in 2.6.32 (Part 3) - Storage

TV Mythos Renewed: MythTV 0.22 with Many Improvements

Enhancing openSUSE 11.2: Adding Repositories and Packages

A Northwest Nobel option? (Linus for the Nobel Peace prize)

SECURITY: Cloud Computing Security Benefits, Risks and Recommendations

Keeping score in test-driven development with Python, PyLint, unittest, doctest,

Win a CodeWeavers Linux Gaming Rig




Sr Systems Engineer - Solaris - AIX (TX)
Next Step Systems
US-TX-Houston

Justtechjobs.com Post A Job | Post A Resume
:Linux Gazette: The Deep, Dark Secrets of Bash
Linux Gazette: The Deep, Dark Secrets of Bash
Jul 8, 2000, 18 :56 UTC (0 Talkback[s]) (4570 reads)

(Other stories by Ben Okopnik)

"Deep within the bash man page lurk terrible things, not to be approached by the timid or the inexperienced... Beware, Pilgrim: the last incautious spelunker into these mysterious regions was found, weeks later, muttering some sort of strange incantations that sounded like "nullglob", "dotglob", and "MAILPATH='/usr/spool/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"'" (He was immediately hired by an Unnamed Company in Silicon Valley for an unstated (but huge) salary... but that's beside the point.)"

"The built-in parsing capabilities of bash are rather minimal as compared to, say, perl or awk: in my best estimate, they're not intended for serious processing, just "quick and dirty" minor-task handling. Nevertheless, they can be very handy for that purpose. As an example, let's say that you need to differentiate between lowercase and capitalized filenames in processing a directory - I ended up doing that with my backgrounds for X, since some of them look best tiled, and others stretched to full-screen size (file size wasn't quite a good-enough guide). I "capped" all the names of the full-sized pics, and "decapped" all the tiles. Then, as part of my random background selector, "bkgr", I wrote the following..."

"There are times - say, in testing for a range of error conditions that set different variables - when we need to know whether a specific variable is set (has been assigned a value) or not. True, we could test it for length, as I did above, but the utilities provided by bash for the purpose provide convenient shortcuts for such occasions..."

"Another built-in capability of bash, a basic mechanism for handling arrays, allows us to process data that needs to be indexed, or at least kept in a structure that allows individual addressing of each of its members. Consider the following scenario: if I have a phonebook/address list, and want to send my latest "Sailor's Newsletter" to everyone in the "Friends" category, how do I do it? Furthermore, say that I also want to create a list of names of the people I sent it to... or some other processing... i.e., make it necessary to split it up into fields by length, and arrays become one of the very few viable options. Let's look at what this might involve..."

Complete Story

Related Stories:
Linuxnewbie.org: Bash Programming Cheat Sheet(Jun 14, 2000)
About.com: Basic BASH Scripting(May 28, 2000)
IBM developerWorks: Bash by example, Part 2(Apr 09, 2000)
Linux Gazette: Introduction to Shell Scripting--The Basics(Apr 02, 2000)
IBM developerWorks: Bash by example, Part 1(Mar 30, 2000)
Linuxcare: Dear Lina: Bashful about bash(Mar 27, 2000)
LinuxPR: Announcing Free Download of the Bash Reference Card(Dec 07, 1999)
ext2: Bash basics(Nov 03, 1999)
LinuxNewbie.org: Introduction To BASH Shell Scripting: Version 1.2(Oct 24, 1999)



No talkbacks posted.
  Home | Search Talkbacks | Customize View    Top of Page  



Enter your comments below:

* Your Name:

* Your Email Address:

* Subject:

CC: [will also send this talkback to an E-Mail address]

* Comments:

Tags allowed:<I>,<B> and <U>. See our talkback-policy for more about talkback content.

Fields marked with * are required!






..............................




All times are recorded in UTC.
Linux is a trademark of Linus Torvalds.
Powered by Linux, Apache and PHP

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs