The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sort command - strange behaviour miwinter UNIX for Advanced & Expert Users 16 05-29-2008 07:19 AM
TEST command amatuer_lee_3 Shell Programming and Scripting 4 05-09-2008 07:36 AM
a strange message when executing the sort command marwan UNIX for Dummies Questions & Answers 3 04-27-2007 07:32 AM
the TEST command marwan UNIX for Dummies Questions & Answers 2 04-23-2007 06:51 PM
Strange error message with regex test... fgilain Shell Programming and Scripting 4 05-31-2006 09:52 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-02-2007
jjinno jjinno is offline
Registered User
  
 

Join Date: Jul 2007
Location: Cloud 9
Posts: 72
test command looks strange...

I just ran into this today, and don't know what to make of it...
Code:
if test x$SERVER = x
then
        echo $USAGE
        exit 1
fi
I know what everything in there does, except for the 'x' jazz...
  #2 (permalink)  
Old 11-02-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by jjinno View Post
I just ran into this today, and don't know what to make of it...
Code:
if test x$SERVER = x
then
        echo $USAGE
        exit 1
fi
I know what everything in there does, except for the 'x' jazz...
It is effecitvely doing

Code:
if test "$SERVER" = ""
then
     ....
rather than using quotes, it prefixes an x to the string to ensure it's not an empty string argument. Where it falls down of course is if there is a space in $SERVER.
  #3 (permalink)  
Old 11-02-2007
jjinno jjinno is offline
Registered User
  
 

Join Date: Jul 2007
Location: Cloud 9
Posts: 72
hahahaha... of course, the obvious answer escapes me.

I didn't even think of it as concatenation till you mentioned that.

Thank you
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:40 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0