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
If Statement Problem.. LinuxRacr Shell Programming and Scripting 2 02-27-2008 12:47 AM
Case statement problem gzs553 UNIX for Advanced & Expert Users 6 11-14-2006 04:24 PM
if statement problem djt0506 UNIX for Dummies Questions & Answers 4 12-04-2005 08:16 PM
problem with an IF statement hcclnoodles Shell Programming and Scripting 2 04-17-2003 11:53 AM
if statement problem coughlin74 UNIX for Dummies Questions & Answers 1 09-27-2001 05:31 PM

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 02-12-2008
cleansing_flame's Avatar
cleansing_flame cleansing_flame is offline
Registered User
  
 

Join Date: Nov 2007
Location: NYC
Posts: 37
problem with if statement equality

Here's my script:

/bin/script.sh

echo "hey __, don't forget the password is "kazlo""
echo "insert the name of your file in the next line, be very specific"
read var1
vartest=`find . | grep "$var1"`
echo $vartest
echo "you sure this is the right file? answer next line with (y/n)"
read var2

if test [$var = "y"]
then
scp "$vartest" username@targetserver.org:/Users/username/
echo hopefullyworks
fi



it just skips over my if statement
this is really simple i'm sure but I can't get it to work
any help appreciated
  #2 (permalink)  
Old 02-12-2008
ranjithpr ranjithpr is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 157
Either

if [ $var = "y" ]
then
scp "$vartest" username@targetserver.org:/Users/username/
echo hopefullyworks
fi

Or

if test $var = "y"
then
scp "$vartest" username@targetserver.org:/Users/username/
echo hopefullyworks
fi

Both test and [] are not required then if u use [] then give space after and beore [ and ]
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 06:41 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