Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2008
    Location
    Milwaukee
    Posts
    4

    Unanswered: 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 17:03.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    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

  3. #3
    Join Date
    Oct 2008
    Location
    Milwaukee
    Posts
    4
    Thanks its working now!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •