Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-29-2012
Registered User
 
Join Date: Jan 2012
Posts: 29
Thanks: 17
Thanked 0 Times in 0 Posts
[Solved] what does this do? if [[ -n "${ENV_VAR}" ]]

Hi Guys!

What does this do?

Code:
 if [[ -n "${ENV_VAR}" ]]

what does -n option do here? I can't find the explanation using man test.

Thanks in advance!


Moderator's Comments:
Please view this code tag video for how to use code tags when posting code and data.

Last edited by vbe; 06-29-2012 at 11:53 AM.. Reason: code tags
Sponsored Links
    #2  
Old 06-29-2012
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Location: Switzerland - GE
Posts: 4,633
Thanks: 118
Thanked 256 Times in 245 Posts
-n is a string operator, checking if the given operand size is non zero ... If the case, returns true.
Sponsored Links
    #3  
Old 06-29-2012
methyl methyl is offline Forum Staff  
Moderator
 
Join Date: Mar 2008
Posts: 6,388
Thanks: 286
Thanked 668 Times in 640 Posts
Because of the double square brackets, this is actually a Conditional Expression not a Test. Therefore the explanation would be in the Conditional Expressions section of the manual for your Shell .

In most modern Shells it's actually the same explanation as Test.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[Solved] Need help with HP-UX 11.31 LVM! zixzix01 Emergency UNIX and Linux Support !! Help Me!! 6 06-09-2011 05:51 AM
Solved: AWK SED HELP viveksr Shell Programming and Scripting 0 01-25-2011 01:50 PM
[solved] merging two files and writing to another file- solved mlpathir Shell Programming and Scripting 1 10-07-2010 06:41 PM
can this been solved with awk and sed? mskcc Shell Programming and Scripting 16 11-10-2005 11:52 AM



All times are GMT -4. The time now is 03:36 PM.