Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    UK
    Posts
    825

    shell scripting redirection question

    Code:
    ftp -v -n $Host << FTPSCRIPT
    user $Username $Password
    cd somedir
    delete somefile.txt
    bye
    FTPSCRIPT
    	
    echo "completed..."
    the above is a simplified snippet from a shell script that I'm working on at the moment. It basically logs into an FTP account, changes directory, then deletes a file and exits. This works OK.

    The problem I'm having is that it never gets to the echo "completed..." line and doesn't continue with the rest of the script.

    Anyone have any ideas why that is? I've got a feeling this is something very simple that I'm missing to do with the redirection but haven't been able to find an explanation online. I'm pretty new to shell scripting.

  2. #2
    Join Date
    Dec 2002
    Location
    UK
    Posts
    825
    Never mind. Figured it out eventually. As my code is indented to keep it nice and tidy (which you don't see in the snippet above), the FTPSCRIPT line was indented with a tab, where it needs to be at the start of a new line for it to be recognised as the closing string. Doh!

Posting Permissions

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