Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Apple Computing Products:
macOS - Operating System
FTP Shell Script Q.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="edwardlscott" data-source="post: 1121633" data-attributes="member: 174745"><p>I am new to Shell scripting. I found an example script to do an FTP file transfer and modified it to my circumstances. It seems straightforward:</p><p></p><p>#!/bin/bash </p><p>ftp -i <a href="ftp://username:pswrd@webaddress.com" target="_blank">ftp://username:pswrd@webaddress.com</a></p><p>cd big/long/pathname/</p><p>get filename.zip /localpath/filename.zip</p><p>bye </p><p>EOF</p><p></p><p>Invoked from Terminal it connects successfully but the cd command does not execute and I simply get the ftp> prompt within terminal like this:</p><p></p><p>Connected to theserver.com.</p><p>220 theserver.com FTP server ready.</p><p>331 Password required for username.</p><p>230 User username logged in.</p><p>Remote system type is UNIX.</p><p>Using binary mode to transfer files.</p><p>200 Type set to I.</p><p>ftp> </p><p></p><p>I can now execute ftp commands. If I type exit, the last two lines of the script (cd and get lines) then execute out-of-context within terminal and generate "command not found" errors. </p><p></p><p>Any suggestions on why the cd and get commands won't execute from inside the script after ftp connects?</p><p></p><p>Thanks in advance. ~Ed</p></blockquote><p></p>
[QUOTE="edwardlscott, post: 1121633, member: 174745"] I am new to Shell scripting. I found an example script to do an FTP file transfer and modified it to my circumstances. It seems straightforward: #!/bin/bash ftp -i [url]ftp://username:pswrd@webaddress.com[/url] cd big/long/pathname/ get filename.zip /localpath/filename.zip bye EOF Invoked from Terminal it connects successfully but the cd command does not execute and I simply get the ftp> prompt within terminal like this: Connected to theserver.com. 220 theserver.com FTP server ready. 331 Password required for username. 230 User username logged in. Remote system type is UNIX. Using binary mode to transfer files. 200 Type set to I. ftp> I can now execute ftp commands. If I type exit, the last two lines of the script (cd and get lines) then execute out-of-context within terminal and generate "command not found" errors. Any suggestions on why the cd and get commands won't execute from inside the script after ftp connects? Thanks in advance. ~Ed [/QUOTE]
Verification
Post reply
Forums
Apple Computing Products:
macOS - Operating System
FTP Shell Script Q.
Top