Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (4) </ 1 2 3 [4] >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Startup Configs, bootlocal, bash_profile, etc.< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Oct. 23 2006,03:37 QUOTE

oh yeah...that's extremely handy.
It also supports multiple results and case (as in upper or lowercase) variations, too.  For example, you can use y|yes|YES) or [Yy][Es][Ss]) to test for variations on a "yes" response, where with "if" you'd need to make a long string to test for all of those variations.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: Nov. 02 2006,12:22 QUOTE

One thing that's nice about this type of thread is how different users get deep into their particular issues on dsl, then provide a resource for the rest of us by posting.  If I feel the urge to fiddle with some of this stuff , Mikshaw's already done the work for us - all I have to do is find it on the forum.

PS: I like case statements, too. I find them readable. Globbing in them can be handy also.  For eg, Karl Knopper uses this type of thing a lot to test for a string within a string:

Code Sample
case $STRING in
*$PATTERN* ) do_something;;
*) do_something_else;;
esac


or something like that.  This runs much faster than doing
Code Sample
if echo $STRING | grep -q $PATTERN; then


which can be slow.
Back to top
Profile PM 
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: Nov. 02 2006,13:15 QUOTE

Good point. I need to make some changes to my scripts. ;)

--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: Nov. 03 2006,17:00 QUOTE

I suppose you'd only need to change your scripts if they were noticeably slow - which greps can certainly do if you're grepping moderately biggish files etc.

That famous C guy whats-is-name said "the best optimization is usually no optimization".  He was referring to much optimization of code being insignificant on modern processors, therefore time wasting and bug prone, and that readability was more important.

BTW I meant to say KLAUS Knopper - sorry Klaus baby!
Back to top
Profile PM 
18 replies since Aug. 03 2005,18:47 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (4) </ 1 2 3 [4] >/
reply to topic new topic new poll
Quick Reply: Startup Configs

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code