Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 20-08-2009
Member
 
Join Date: Jul 2009
Posts: 42
Double Ampersand in bash script programming

Hi guys, I'm new to linux and started liking it already. I find programming quite fascinating and so have started with basic bash script programming. I was a little familiar with batch programming on in widows based systems. Well as i am new to bash and yet learning its obvious that i will come across problems. I want to know what Double Ampersand in bash script programming stands for? I hope i will get appropriate help soon... Thanks in advance...
Reply With Quote
  #2  
Old 20-08-2009
Member
 
Join Date: Jan 2009
Posts: 289
Re: Double Ampersand in bash script programming

I am not very familiar with bash programming and scripting, but i know that some symbolic representation in all languages stands for the same thing. As i'm familiar with some C++ programming i can say double ampersand [&&] stand for conditional loops when you want two or more conditions to be true, then this symbol && is used. Double Ampersand simply means 'AND'. You can use double ampersand for boolean AND operation also or for comparision. You will get a fair idea as you implement this in your programs. I hope this helps you...
Reply With Quote
  #3  
Old 20-08-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Double Ampersand in bash script programming

Bash script programming is not more different then batch programming of windows. The only difference is the syntax of commands that you use in [Windows and Linux] both the operating systems. Also bash needs to know which shell it will be executing programs for which isn't the case in batch programming of windows. Double Ampersand in bash represents AND operation. This can be used anywhere when such an instruction is needed. Like if you need to execute two commands or you need to exit two running child processes or anywhere at a time two or more then one task has to be performed...
Reply With Quote
  #4  
Old 20-08-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Double Ampersand in bash script programming

Well, thats correct but not fully. In bas scripting and programming, Double Ampersand stands for pure AND. This means AND condition must be satisfied. Suppose you want to execute two instructions, you can also use other ways to do this, but if you use double ampersand, the second instruction will only be executed if the first one succeeds. Because if the first one fails then even if the second instruction succeeds, the AND instruction is not satisfied. So if the first instruction fails, it won't attempt to run the second one.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Double Ampersand in bash script programming"
Thread Thread Starter Forum Replies Last Post
Bash script needs to e-mail output Kim|ball Technology & Internet 4 27-05-2011 10:19 AM
How to create CGI script in bash? Mulan Software Development 5 01-09-2010 08:19 PM
Create bash script for ftp teenQ Operating Systems 4 04-03-2010 07:37 PM
Bash script if then else help Unix'EM Software Development 3 18-08-2009 06:34 PM
BASH Programming Functions Jackie Software Development 1 17-03-2009 12:48 PM


All times are GMT +5.5. The time now is 09:05 AM.