The UNIX and Linux Forums  

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
file comparison satish.res Shell Programming and Scripting 7 10-09-2008 08:55 AM
need some help..Comparison bluesilo Shell Programming and Scripting 0 02-23-2008 04:43 PM
Unix comparison NewGuy100 UNIX for Dummies Questions & Answers 1 12-14-2005 04:42 PM
dir comparison help ghazi Shell Programming and Scripting 5 12-20-2004 05:54 PM
comparison cnf Filesystems, Disks and Memory 2 05-14-2002 02:52 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-08-2009
Freakhan Freakhan is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 10
variable comparison

Hello,

I am trying to compare two variables, which both have a word stored in it.
The code I am using is. Please tell me which one of these is correct.Or please tell me the correct syntax.
Thankyou

if [ $variable1=$variable2 ] then

if [ $($variable1)=$($variable2) ] then

if [ "$variable1"="$variable2" ] then

if [ "$variable1" = "$variable2" ] then

if [ "$variable1" -eq "$variable2" ] then

None of them seems to work for me.
 

Bookmarks

Tags
variable comparison

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 09:02 AM.


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