Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 31st May 2006, 19:37
tombstone tombstone is offline
Junior Member
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default bash script compare variables pattern matching

Fairly new to bash scripting and I'm having a hard time wrapping my head around this one.
Lets say I have 2 variables

user and db
db='username_blah'
user='username'

how would I compare those 2 saying
if user=beginning of db(everything before the_) ;
then
code here
fi
sometimes I'l have db be somethin_blah
and username will be 'something' (minus the last letter or letters) how would I do the same thing there

hope I was clear enough
help would be appreciated

Tombstone
aka
Tommy two cups
Reply With Quote
  #2  
Old 1st June 2006, 01:27
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
Default

Have a look here: http://www.tldp.org/LDP/abs/html/index.html and especially here: http://www.tldp.org/LDP/abs/html/tests.html
__________________
Falko
--
Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash: Assigning variables sjau Programming/Scripts 6 22nd May 2006 21:07
req: Bash / Script to auto kill PID if it's needed.... edge Programming/Scripts 8 14th March 2006 00:31


All times are GMT +2. The time now is 00:07.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Sponsored Links: Unified Communications: Thoughts, Strategies and Predictions
Join the discussion.
www.seamlessenterprise.com

IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com

Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com

Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com

Red Hat Virtual Experience - a free virtual event. Dec. 9th