LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-26-2012, 04:21 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 30
Condition


can advise if I would like to set a condition if v1 begins with A or a , then go to the loop , what can i do ?

Thanks.

eg.

if [[ $v1 =~ ^A ]]

then

..
 
Old 09-26-2012, 04:25 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
Code:
case "$v1" in
   [aA]*) # this is your case
      ;;
   *) ;; # this is "all other cases"
esac
probably will work in bash
 
Old 09-26-2012, 04:53 AM   #3
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 30
it works , thanks.
 
Old 09-26-2012, 05:18 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
Quote:
Originally Posted by ust View Post
it works , thanks.
if you think your problem is solved, please mark this thread as SOLVED. Also if you want to say thanks, please press YES (bottom right corner)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] if condition shashv2 Programming 2 07-29-2010 10:52 AM
[SOLVED] If Condition with logical AND chirayu11 Linux - Newbie 2 07-29-2010 07:17 AM
if condition furqan_sindhu Linux - Newbie 5 09-22-2007 07:56 AM
using OR condition in if condition Fond_of_Opensource Linux - Newbie 2 10-20-2006 01:34 AM
preg not condition dlublink Programming 5 05-31-2006 01:39 AM


All times are GMT -5. The time now is 02:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration