expect and stty paths are different and resulting in error.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers expect and stty paths are different and resulting in error.
# 1  
Old 07-15-2008
Question expect and stty paths are different and resulting in error.

Hello,

i am using expect to automate file transfers to and fro with a sftp server.

below is the script i am creating and executing in the main program.
Quote:
#!/usr/local/bin/expect
spawn ftp user@ftpsite.com
expect "username:"
send "user\r"
expect "password:"
send "passwd\r"
expect "ftp>"
send "binary\r"
expect "ftp>"
send "cd /path/on/ftp/server/\r"
expect "ftp>"
send "ls -l filename_*.pgp\r"
expect "ftp>"
send "bye\r"
interact
but i am getting the following error:

Quote:
spawn ftp ftp_server
sh: /usr/local/bin/stty: not found
Connected to ftp_server.
220 ftp_server FTP server (SunOS 5.8) ready.
Name (ftp_server:user): user
331 Password required for user.
Password:
230 User user logged in.
ftp> binary
200 Type set to I.
ftp> cd /path/on/ftp/server/
250 CWD command successful.
ftp> ls -l filename_*.pgp
200 PORT command successful.
150 ASCII data connection for /bin/ls (ftp_server,11111) (0 bytes).
226 ASCII Transfer complete.
local: filename.txt.r.pgp remote: -l
90 bytes received in 0.0042 seconds (21.02 Kbytes/s)
ftp> bye
221 Goodbye.
Quote:
sh: /usr/local/bin/stty: not found
the main program that creates and runs this script looks for words like "not found" in the log file that is created and decides whether there was an error in the sftp process. In this case there is an error.

i am on working on SunOS 5.8 korn shell. i did some research on this and found out that the "expect" program is in the "/usr/local/bin" folder and stty is in "/usr/bin".

i also check the $PATH variable and both "/usr/local/bin" and "/usr/bin" are present.

can anyone help me with this particular issue? any help appriciated.

Thank you.

Last edited by The Nemi; 07-16-2008 at 12:47 PM..
# 2  
Old 07-15-2008
I would do a simlink of expect in /usr/bin and see if it solves your problem...
you would have /usr/bin/expect -> /usr/local/bin/expect
# 3  
Old 07-16-2008
for some reason the sysadmins are a bit reluctant to add the symbolic link....

can the stty program be installed in 2 different places on one server....for example....can stty be present in /usr/local/bin and /usr/bin ?
# 4  
Old 07-16-2008
Well that was the idea using a symbolic link, stty would have been seen "as" in /usr/local/bin also... but saves you the copy and maintnance of 2 binaries...
But I would try to argue that before anything else you want to see IF this link solves the issue before deciding what is going to be done (we may be wrong after all...)
# 5  
Old 07-16-2008
I think that is the only option we have to create a symbolic link. I also learned that the path for stty is hard coded in the expect program.

i will create a symbolic link and let you know how it turns out. thank you for your help VBE.
# 6  
Old 07-16-2008
But as I suggested, I would start by a simlink of expect in /usr/bin
# 7  
Old 07-17-2008
The sysadmins did that (not sure they did it the right way)....but when i go to cd /usr/local/bin and do a ls -l i can see bin -> /usr/bin

please let me know whether it should look the way i described.

after creating the simlink i tested the script and i am still getting the same error sh: /usr/local/bin/stty: not found
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect Script not running from cron. Full Paths used

My cron file. Copied $PATH # Minute Hour Day of Month Month Day of Week Command SHELL=/bin/ksh PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/perl/lib:/perl/lib/lib/perl5:/perl/scripts:.:/perl/lib/local:/home/popeye:/temp 0... (3 Replies)
Discussion started by: popeye
3 Replies

2. Emergency UNIX and Linux Support

Zip all the files resulting from a sed command

hi guys i have a file in this location /home/test/Summary.txt - this file contants is a below ./log_SI-100.lst:Error detected, rollbacking ./log_SI-101.lst:Error detected, rollbacking ./log_SI-106.lst:Error detected, rollbacking i use this command to get the log file names inside it ... (2 Replies)
Discussion started by: depakjan
2 Replies

3. Red Hat

Server load rapidly increases resulting in complete freeze

Hi All, I run Linux server that hosts PHP/MySQL web-projects. The problem is that it becomes irresponsive periodically, avg. load rapidly goes up to 100.0 and more and I have to do cold reboot. Usually this sudden increase happens in 1-2 mins and it's very difficult to catch this moment in... (0 Replies)
Discussion started by: livedatesearch
0 Replies

4. Shell Programming and Scripting

stty: : I/O Error

Hi all, I am stuck on a shell script issue and need your inputs: I have a parent script A.ksh which call in another script B.ksh. At the start of the B.ksh, we export the .profile of another user and then call Informatica jobs. Issue When I run my jobs from the command prompt, it works... (1 Reply)
Discussion started by: fromrishi
1 Replies

5. Shell Programming and Scripting

stty error when script is called out of a cronjob

Hello, I'm trying to implement a script to call a third-party tool every so often and write the results to a file. If I run it interactively it works fine, but when it comes to run it out of a cronjob, I keep getting this error: stty: tcgetattr: a specified file does not support the... (3 Replies)
Discussion started by: fabiogilr
3 Replies

6. Solaris

SC3.2 issue - cluster transport configuration not right - resulting fail

I am trying to set up a two host cluster. trouble is with the cluster transport configuration. i'm using e1000g2 and g3 for the cluster transport. global0 and global1 are my two nodes, and I am running the scinstall from global1. i think i should be expecting, is this: The following... (19 Replies)
Discussion started by: frustin
19 Replies

7. UNIX for Dummies Questions & Answers

stty: : Not a typewriter with AUTOSYS error

(sys10:pt:/pf>) cat 122974qqq.s RUNAS Version 2007.10.07 Run on Dec 11 2008 10:09:36 AM UNIX Process: 26021 Login User : root PFW User : s08280 Not a terminal stty: : Not a typewriter stty: : Not a typewriter ksh: jil: not found ksh: sendevent: not found... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

8. Shell Programming and Scripting

bash: dividing/multiplying variables resulting in decimals

(4 Replies)
Discussion started by: puddy
4 Replies

9. UNIX for Advanced & Expert Users

stty: error occurs when installing rpm

Hello All, when I install rpm rpm --install rpm packagename I got the following errors stty:standard input:invalid argument stty:standard input:invalid argument I dont know what i have to do exactly. I search on google for the same but not a particular standard solution is given... (17 Replies)
Discussion started by: amitpansuria
17 Replies

10. UNIX for Dummies Questions & Answers

ctrl+S resulting in (i-search) in bash

Hi On solaris, when I press Ctrl+S on an XTERM, the window normally freezes. But today on the same machine, the Ctrl+S key results in (i-search) !! I understand that it has got something to do with emacs (may be not). But I do not use emacs at all. Other specific keys including <backspace>,... (3 Replies)
Discussion started by: balaji280283
3 Replies
Login or Register to Ask a Question