Hope it was ok to post this question here. I've seen script questions here before.

Kevin Buettner plug-discuss@lists.plug.phoenix.az.us
Fri, 5 Apr 2002 13:13:05 -0700


On Apr 5, 11:29am, Steve Young wrote:

> I seem to have a problem with a KORN shell script I'm using on a AIX
> box that ftp's to an NT box.  The script makes a macro file that is
> fed to the ftp command the script uses and then letter the script rm
> the macro file.  The part of the script I'm having a problem with
> goes like this:
> 
> print prompt > $FTP_FIL                                                           
> print macdef login >> $FTP_FIL                                                  
> print "open $FTPSITE" >> $FTP_FIL                                                
> print 'user steve\\ftpaix passwd' >> $FTP_FIL               
> # Insert a blank line to denote the end of the macro                            
> print >> $FTP_FIL  
> 
> It's the line:
> 
> print 'user ecom\\ftpaix m1cr0age' >> $FTP_FIL   

This line doesn't match the line you listed above.  Could it be that
you just gave away a secret that you didn't intend to?

> that seems to create the prob for me.  It comes out right with just
> one backslash in the file I make, however the ftp shell (I believe)
> picks it up as an escape character.  I was wondering how to get
> around this of if there were even a way to do it.

The \ character has special meaning to ftp's macdef command.  If the
file you create only has one backslash character, and you want to send
one backslash character as part of the username, then you might need to
do something like this in your script which creates the macro file:

    print 'user steve\\\\ftpaix passwd' >> $FTP_FIL               

(If I were writing the script, I'd write it all in perl using Net::FTP.
That way, you avoid many of these problems.)

Kevin