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: 1122999" data-attributes="member: 174745"><p>Thanks for all the help so far!</p><p></p><p>ukchucktown, I followed your advice and learned some about file redirection from your link (although it a little mysterious why it isn't called i/o redirection). The technique of creating the co-process and feeding the ftp commands into it using "print -p" commands makes sense, so I borrowed the code example and tried it. Stuck on line three code where sub-process should create. Script now looks like this:</p><p></p><p>#!/bin/bash </p><p>exec 4>&1</p><p>ftp -nv >&4 2>&4 |&</p><p>print -p ftp -in <a href="ftp://username:pwd@URL" target="_blank">ftp://username:pwd@URL</a></p><p>print -p cd big/long/pathname</p><p>print -p get filename.zip localpath/filename.zip</p><p>print -p bye</p><p>wait</p><p>exit 0</p><p></p><p>Here is the error:</p><p></p><p>-bash: syntax error near unexpected token `&'</p><p></p><p>Further web searching leads me to believe the example code I borrowed was written for Korn shell, not Bash. Now "over my head" is an understatement, I can't even see the coastline.</p><p></p><p>Any further guidance much appreciated as sorting out syntax errors requires a trained eye and Googling doesn't help much unless you are lucky.</p></blockquote><p></p>
[QUOTE="edwardlscott, post: 1122999, member: 174745"] Thanks for all the help so far! ukchucktown, I followed your advice and learned some about file redirection from your link (although it a little mysterious why it isn't called i/o redirection). The technique of creating the co-process and feeding the ftp commands into it using "print -p" commands makes sense, so I borrowed the code example and tried it. Stuck on line three code where sub-process should create. Script now looks like this: #!/bin/bash exec 4>&1 ftp -nv >&4 2>&4 |& print -p ftp -in [url]ftp://username:pwd@URL[/url] print -p cd big/long/pathname print -p get filename.zip localpath/filename.zip print -p bye wait exit 0 Here is the error: -bash: syntax error near unexpected token `&' Further web searching leads me to believe the example code I borrowed was written for Korn shell, not Bash. Now "over my head" is an understatement, I can't even see the coastline. Any further guidance much appreciated as sorting out syntax errors requires a trained eye and Googling doesn't help much unless you are lucky. [/QUOTE]
Verification
Post reply
Forums
Apple Computing Products:
macOS - Operating System
FTP Shell Script Q.
Top