Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7437749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:26:50+00:00 2026-05-29T10:26:50+00:00

If I run the wget command listed below in the script by itself on

  • 0

If I run the wget command listed below in the script by itself on the command line, it works fine and downloads all the files I specify. If I run the wget in a script with the ftp command directly after it, it does not download the files, but the ftp command successfully deletes them. I have no idea why this is happening. Shouldn’t the wget command complete fully before passing off control to the ftp command to execute?

I’m using Windows 7 with Cygwin installed. Below is the contents of fileFetcher.sh which I run with bash fileFetcher.sh. For both the script and the output I’ve edited some things to remove usernames, passwords, and hostnames.

Also I would like to mention I don’t really understand the < < END_SCRIPT construction that I used. I found it on another website and customized it for this script. It seems like it lets me embed a script inside a script. I don’t know if this is somehow the source of an error.

Again both these commands work fine /by themselves/ but once they’re in the script they don’t play nice together.

wget -r -l1 -nd --no-parent -A.tgz -t3 --user='username' --password='password' ftp://ftp.hostname.org/backups/
ftp -n -i -d ftp.hostname.org <<END_SCRIPT
quote USER username
quote PASS password
cd backups
mdelete *.tgz
ls
quit
END_SCRIPT
exit 0

Below this line is the output from the bash script being run. The wget command runs first, and DOES NOT download the files.

$ bash fileFetcher.sh
--2012-02-07 23:00:46--  ftp://ftp.hostname.org/backups/%0D
       => `.listing'
Resolving ftp.hostname.org (ftp.hostname.org)... 200.205.124.20
Connecting to ftp.hostname.org (ftp.hostname.org)|200.202.137.60|:21... connected.
Logging in as username ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /backups ... done.
==> PASV ... done.    ==> LIST ... done.

[ <=>                                                                           ] 467          --.-K/s   in 0s

2012-02-07 23:00:47 (6.41 MB/s) - `.listing' saved [467]

Removed `.listing'.
--2012-02-07 23:00:47--  ftp://ftp.hostname.org/backups/%0D
       => `%0D'
==> CWD not required.
==> SIZE \r ... done.
==> PASV ... done.    ==> RETR \r ...
No such file `\r'.

Below this line the ftp portion of the shell script logs in and deletes the files properly.

---> USER $username
---> PASS $password
---> CWD backups
---> TYPE A
---> PORT 192,168,0,91,223,12
---> NLST *.tgz
---> TYPE A
---> DELE website backup 2012-02-07 20-18-48.tgz
---> DELE website backup 2012-02-07 20-18-49.tgz
---> DELE website backup 2012-02-07 20-18-50.tgz
---> PORT 192,168,0,91,223,13
---> NLST
.
..
---> QUIT
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:26:51+00:00Added an answer on May 29, 2026 at 10:26 am

    The \r‘s in the output (there’s a telltale %0D in there, too) indicate a problem. A Cygwin shell script must use Unix line endings (\n) and not DOS/Windows line endings (\r\n).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so I need to run wget but I'm prohibited from creating 'dot' files
I'm running a PHP script via cron using Wget, with the following command: wget
I am trying to create a script that will run wget to a few
I run my blog using Wordpress and all too recently became a big believer
I run into similar codes like this all the time in aspx pages: <asp:CheckBox
I wrote a quick script to download files using LWP::Simple library and its getstore()
I need to run a specific mysql query upon wget, which is running in
I'm trying to run a PHP script from CRON every 15 minutes from 9AM
I have a bash file that contains wget commands to download over 100,000 files
Okay so I have a bash script that simply downloads a web page, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.