Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have written an ftp script, a

Status
Not open for further replies.

ZK

MIS
Oct 2, 2000
27
GB

I have written an ftp script, and have figured out how to start the script under unix - by using the command

'ftp < scriptname.ftp'

But it says that my username contains illegal characters. But the script works fine under DOS. So why is this?

Also, you may have realised that I am very new to Unix, so I was wondering what '#!/usr/bin/ksh' was.

Thanks
ZK [sig][/sig]
 
The &quot;#!/usr/bin/ksh&quot; is a special directive to the shell. When you run a script, the shell check the first line of the script. If it begins with &quot;#!&quot; starting at the first character, the following string is used as the program to execute the rest of the script.

So, if you run a script with &quot;#!/usr/bin/ksh&quot; from a bash shell, the script will actually run using /usr/bin/ksh.

With your FTP script, are you using an anonymous login? If so, then I guess you are sending your email address as the password. Try putting a &quot;\&quot; character before the &quot;@&quot; character. This escapes any special meaning the &quot;@ character may have. [sig]<p> Andy Bold<br><a href=mailto: > </a><br><a href= > </a><br>"I've probably made most of the mistakes already, so hopefully you won't have to..." Me, most days.[/sig]
 
Have you poosted it to the awk forum? [sig]<p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>Top man[/sig]
 
Hi guys

No, I'm not logging in as anonymous. The error message says that my username (which works fine under DOS) contains illegal characters. But all the characters are text characters.

Any ideas?

ZK [sig][/sig]
 
what's the user-name then? [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Don't no how my last post got into this thread, my appologies.

ZK, can you post the start of your ftp script (you can change any names to protect the inocent). [sig]<p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>Top man[/sig]
 
At the command line, I type

ftp < (ftpscript).ftp

Here is the start of my ftp script:

open w.x.y.z
<username> this is just characters
<password> this is just characters
cd <directory>
put <file> <new_file>
bye

That's it. The thing is, the username which it thinks contains illegal characters is fine becuase it's correct. The script works fine under DOS, so why not under unix?

Thanks
ZK [sig][/sig]
 
try this in your shell script:
[tt]
ftp -v -n <<!
open host.company.com
quote user mlacey
quote pass mikespassword
put thingy there
get that fromthere
quit
!
[/tt]
[sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Yes! Mike is right, the lowly pcs' FTP try to login automagically, but you are giving literally the login instruction then give a -n argument to your FTP client to not login!

I hope it works... [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top