LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 07-07-2009, 01:20 PM   #1
tirengarfio
Member
 
Registered: Nov 2006
Posts: 45

Rep: Reputation: 15
Two square brackets in bash condition


Hi!,

is there any difference between these expressions??

Code:
if [ -z "nmap -p 22 $i |grep open" ]; then

if [[ -z "nmap -p 22 $i |grep open" ]]; then
Bye
 
Old 07-07-2009, 01:36 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
they do the same thing there, but some background reading on what the differences are outside of this would be useful... http://www.ibm.com/developerworks/li...bash-test.html
 
  


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
square brackets in output of "ps aux" not matching output of "ps -ejH" alirezan1 Linux - Newbie 14 07-14-2010 05:17 AM
regular expression comma between brackets pcock Programming 1 03-19-2009 11:26 PM
multiple if condition in bash tikit Programming 6 11-12-2008 02:34 PM
Konqueror and Square Brackets in Folder/File Names fortezza Linux - Software 2 12-19-2005 11:10 PM
Kmail--Unbalanced Brackets mooreted Linux - Software 4 01-14-2005 08:41 PM


All times are GMT -5. The time now is 12:16 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration