If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
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, 11: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, 17: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, 11: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

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