HPE GreenLake Administration
- Community Home
 - >
 - Servers and Operating Systems
 - >
 - Operating Systems
 - >
 - Operating System - HP-UX
 - >
 - Expect - Rookie questions
 
Operating System - HP-UX
        1840131
        Members
    
    
        2588
        Online
    
    
        110161
        Solutions
    
Forums
        Categories
Company
Local Language
                
                  
                  back
                
        
                
        
                
        
                
        
        
        
                
        
                
        
        
        
                
        
              
              Forums
Discussions
Forums
- Data Protection and Retention
 - Entry Storage Systems
 - Legacy
 - Midrange and Enterprise Storage
 - Storage Networking
 - HPE Nimble Storage
 
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
                
                  
                  back
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
            
                
            
                
            
                
            
                
            
            
                
            
                
            
            
                
            
                
              
            Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
 - Appliance Servers
 - Alpha Servers
 - BackOffice Products
 - Internet Products
 - HPE 9000 and HPE e3000 Servers
 - Networking
 - Netservers
 - Secure OS Software for Linux
 - Server Management (Insight Manager 7)
 - Windows Server 2003
 - Operating System - Tru64 Unix
 - ProLiant Deployment and Provisioning
 - Linux-Based Community / Regional
 - Microsoft System Center Integration
 
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
        Information
        Community
Resources
Community Language
        Language
        Forums
Blogs
	
		
			
            
                
            Go to solution
        
            
		
		
			
            	
	
		
        
		
	
	
		Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
 - Mark Topic as New
 - Mark Topic as Read
 - Float this Topic for Current User
 - Bookmark
 - Subscribe
 - Printer Friendly Page
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
07-15-2004 07:05 AM
07-15-2004 07:05 AM
			
				
					
					
						I have downloaded what I need to use expect and compiled etc and it appears to be working just fine.
Now, my problem is actually trying to get it to work and use my required inputs to complete an ftp process.
My problem is this. We have made some network changes and I need to ftp to the proxy server first before going out to the 'outside' world.
My expect script looks like this:
spawn ftp (ip address of proxy server)
expect "User" ; send "username@destination site\n"
expect "Password: ; send "password\n"
expect "ftp>"
send " cd /directory\n"
expect "ftp>"
send " del oldfile.txt\n"
expect "ftp>"
send " rename file.txt file-old.txt\n"
expect "ftp>"
send " put newfile.txt\n"
expect "ftp>"
send "bye\n"
I have tested all these steps in sequence from the command line and it works perfectly, but from expect it bombs.
Any ideas?
I am on HPUX11i, ftping to a Windows Server I believe, but it shouldn't matter because it works from the command line, just not within expect.
Thanks
	
			
				
		
			
			
			
			
			
			
		
		
		
	
	
	
Now, my problem is actually trying to get it to work and use my required inputs to complete an ftp process.
My problem is this. We have made some network changes and I need to ftp to the proxy server first before going out to the 'outside' world.
My expect script looks like this:
spawn ftp (ip address of proxy server)
expect "User" ; send "username@destination site\n"
expect "Password: ; send "password\n"
expect "ftp>"
send " cd /directory\n"
expect "ftp>"
send " del oldfile.txt\n"
expect "ftp>"
send " rename file.txt file-old.txt\n"
expect "ftp>"
send " put newfile.txt\n"
expect "ftp>"
send "bye\n"
I have tested all these steps in sequence from the command line and it works perfectly, but from expect it bombs.
Any ideas?
I am on HPUX11i, ftping to a Windows Server I believe, but it shouldn't matter because it works from the command line, just not within expect.
Thanks
	Always learning
			
			
				Solved! Go to Solution.
		3 REPLIES 3
	
	            
            
		
		
			
            
                - Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
07-15-2004 08:17 AM
07-15-2004 08:17 AM
Solution
			
				
					
					
						Hi,
You have missed to pair a double quote (") on the third line after the string Password.
So, this would be the new line,
expect "Password:" ; send "password\n"
Of course, assuming that you have the correct prompt strings hardcoded in the script just as your windows ftp server would present for the username and password.
HTH,
Abdul.
		
		
	
	
	
You have missed to pair a double quote (") on the third line after the string Password.
So, this would be the new line,
expect "Password:" ; send "password\n"
Of course, assuming that you have the correct prompt strings hardcoded in the script just as your windows ftp server would present for the username and password.
HTH,
Abdul.
	No unix, no fun
			
			
				
			
			
			
			
			
			
		- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
07-15-2004 08:32 AM
07-15-2004 08:32 AM
			
				
					
						
							Re: Expect - Rookie questions
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Try replacing all the "\n"s with "\r"s,
Ex:
spawn ftp (ip address of proxy server)
expect "User"
send "username@destination site\r"
expect "Password: "
send "password\r"
expect "ftp>"
-Karthik S S
		
		
	
	
	
Ex:
spawn ftp (ip address of proxy server)
expect "User"
send "username@destination site\r"
expect "Password: "
send "password\r"
expect "ftp>"
-Karthik S S
	For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
			
			
				
			
			
			
			
			
			
		- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
07-16-2004 02:06 AM
07-16-2004 02:06 AM
			
				
					
						
							Re: Expect - Rookie questions
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						All, I found this on my own yesterday after I actually read what my connection to the computer system was telling me - DOH !!
I was waiting for someone to reply to assign points, like i always try to.
Therefore, thank you and full points to both.
Nickd
		
		
	
	
	
I was waiting for someone to reply to assign points, like i always try to.
Therefore, thank you and full points to both.
Nickd
	Always learning
			
			
				
			
			
			
			
			
			
		The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
		
	
	
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP