Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > if loop not working

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-15-07, 12:54
ranga2727 ranga2727 is offline
Registered User
 
Join Date: Sep 2007
Posts: 11
Red face if loop not working

Hello

i am trying to remove a line using an input file , but this depends upon user interaction

here is the sample

#!/bin/sh
echo "Please enter whether you want to remove Profile"
read value1
if [$value1="y"];then
sed /movie/d temp.txt> temp3.txt
else
echo "Script didnot remove profile"
fi

if the user hit the letter 'y' it should search the string movie from temp.txt and remove that line

Please help me on this .. The above code which i gave won't work as i new to unix shell scripting !!
Reply With Quote
  #2 (permalink)  
Old 09-15-07, 18:48
aigles aigles is offline
Registered User
 
Join Date: Jan 2004
Location: Bordeaux, France
Posts: 319
Your if statement syntax is invalid
Code:
#!/bin/sh echo "Please enter whether you want to remove Profile" read value1 if [ "$value1" = "y" ];then sed /movie/d temp.txt> temp3.txt else echo "Script didnot remove profile" fi
__________________
Jean-Pierre.
Reply With Quote
  #3 (permalink)  
Old 09-16-07, 12:59
ranga2727 ranga2727 is offline
Registered User
 
Join Date: Sep 2007
Posts: 11
Thanks you are right
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On