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, 18: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
Sponsored Links
  #2  
Old 1st June 2006, 00:27
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 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
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | 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 20:07
req: Bash / Script to auto kill PID if it's needed.... edge Programming/Scripts 8 13th March 2006 23:31


All times are GMT +2. The time now is 09:16.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.