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 > Using while command error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-23-08, 11:19
wg1856 wg1856 is offline
Registered User
 
Join Date: Oct 2008
Location: Milwaukee
Posts: 4
Using while command error

Hi all,

I am a new script writer and having a problem with the following code

while [ "forever" ]
do
read ans < /home/aim/$LOGNAME/TELD_TIER1_SUPPORT/script.logs/bill1.$sdate1
enabler=$ans
echo $ans
sleep 3
if [ $ans = "done" ]
then
break
fi
#
# create .netrc file
#
rm -f ~/.netrc
OCD=/home/aim/$enabler/TELD_TIER1_SUPPORT
echo "machine $FTPSERVER" > ~/.netrc
echo "login m62429" >> ~/.netrc
echo "password Bf1234wxA" >> ~/.netrc
echo "lcd $LCD" >> ~/.netrc
echo "cd $OCD" >> ~/.netrc
echo "put $FTPSCRIPT $FTPSCRIPT.NEW" >> ~/.netrc
echo "chmod 777 $FTPSCRIPT.NEW" >> ~/.netrc
echo "quit" >> ~/.netrc
chmod 400 ~/.netrc
ftp -i $FTPSERVER
echo $enabler
done

this is the error I am getting: Unknown .netrc keyword



Unknown .netrc keyword lcd
Unknown .netrc keyword /home/aim/ena25a1/TELD_TIER1_SUPPORT
Unknown .netrc keyword cd
Unknown .netrc keyword /home/aim/ena25a2/TELD_TIER1_SUPPORT
Unknown .netrc keyword put
Unknown .netrc keyword install_script
Unknown .netrc keyword install_script.NEW
Unknown .netrc keyword chmod
Unknown .netrc keyword 777
Unknown .netrc keyword install_script.NEW
Unknown .netrc keyword quit

Last edited by wg1856; 10-23-08 at 16:03.
Reply With Quote
  #2 (permalink)  
Old 10-24-08, 02:02
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
Well the error appear to be related to your .netrc and not the while as suggested by your subject
I've never used a .netrc in this way but thing you need a
macdef init

A better way to create the file would be e.g.
cat <<EOF >your file
cd $yourdir
put $f1 $ft
EOF

But better yet, use it on the ftp command e.g.
ftp -n $FTPSERVER <<EOF
user $user $pass
cd $mydir
quit
EOF
Reply With Quote
  #3 (permalink)  
Old 10-24-08, 11:41
wg1856 wg1856 is offline
Registered User
 
Join Date: Oct 2008
Location: Milwaukee
Posts: 4
Thanks its working now!!!!
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