bash script compare variables pattern matching

Discussion in 'Programming/Scripts' started by tombstone, May 31, 2006.

  1. tombstone

    tombstone New Member

    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
     
  2. falko

    falko Super Moderator Howtoforge Staff

Share This Page