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
comparing the null values in the unix bbc17484 Shell Programming and Scripting 11 02-12-2008 09:36 AM
Comparing data in file with values in table Mohit623 Shell Programming and Scripting 0 01-22-2008 08:57 AM
Problem cutting & comparing values wilsontan Shell Programming and Scripting 6 02-09-2006 11:48 AM
comparing two decimal values in KSH nandinisagar Shell Programming and Scripting 4 11-15-2005 06:36 PM
comparing two float values kavitha Shell Programming and Scripting 2 04-03-2004 01:32 AM

Closed Thread
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
  #1 (permalink)  
Old 05-27-2008
coolkid coolkid is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 69
comparing values of same variable

Hello all
while writing a small script , i got stuck with this simple thing.Hope you guyz can help.

Iam trying to read password

echo"enter password"
read $pwd

now i have to check this
echo"enter password to proceed"
read $pwd

now i have to check both the values of the variable $pwd

if both the values match
echo "verified"
else
echo "wrong password"


Appreciate ur help fellas

--CoolKid
  #2 (permalink)  
Old 05-27-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink An example, with a wink to new James Bond book

Code:
> cat chk_pwd 
#! /bin/bash

echo "Hello there Mr. Bond."
echo " "
echo "Please enter your passcode"
read input1

echo "Please re-enter your passcode"
read input2
echo " "

if [ $input1 = $input2 ]
   then
      echo "Identity verified, you may proceed"
   else
      echo "Security violation, MI6 has been notified"
fi
  #3 (permalink)  
Old 05-27-2008
coolkid coolkid is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 69
That's nice...thanks a ton bud..
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:15 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