Lost files ......

I have ftp'd an ASCII based Expect script onto an AIX box.  I have altered the file attributes to executable and then attempted to run the script.  I get the message ..... " ksh: goto:  not found. ".
I am in the correct directory which is itself included in the PATH variable.  Expect has been installed and seems to function correctly.  I have deleted the file and re-copied several times without success.  The system does not appear to acknowledge that the file exists.

Does anyone have any ideas as to the cause plus the solution of this little difficulty????????
Who is Participating?
chris_calabreseConnect With a Mentor Commented:
alexhudghton's comment implies that you are calling this thing like
  expect /my/script

But your description sounds more like you are just calling
after making it executable.

If this is so, it sounds like you're missing the #! directive at the top of the script to tell the system that this is not a shell script but rather an expect script.  That would usually look something like


Another possibility I thought of is that you're actually calling
  ksh /my/script

which isn't going to work because ksh will always assume this is a shell script.

Finally, it occurs to me that you may also be trying to call the script out of cron, in which case you might need to explicitly call expect like
  expect /my/script
is the route to Expect included in your PATH variable ? (i.e /usr/local/bin/expect or whherever it is)
is the route to Expect included in your PATH variable ? (i.e /usr/local/bin/expect or wherever it is)
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

rigsbyAuthor Commented:
Thanks for the help guys!!!!

I am actually calling the script name just as it is (name only).  The script is a fully working script much used previously but is just being copied to another box,  It already has the " #!/usr/bin/expect -- " first line.

It just appears that the shell (ksh) does not seem to think it exists i.e in the director within the filesystem etc.

The OS is AIX
and Expect is expect- - a freeware archive.

Hope you can help.
Is "goto" the name of the script? What happens if (in that directory) you do "touch test.sh; chmod 755 test.sh; test.sh"?
Is expect actually in /usr/bin, or is it somewhere else?
Either you do not have " expect"  at /usr/bin or /usr/bin/expect does
not have execute permission.

Basically the script you are executing is assumed to be a ksh
script instead of an "expect" script. There is no "goto" in ksh.

If you have #!/usr/bin/expect as you first line it means that
"expect" is the name of the shell to be used for executing the
What happens if you invoke expect with the script as its input (expect myscript)? Has the script passed through a windows box at some point in the FTP transfers between machines? If it did there could be carriage returns at the end of each line that will need to be removed before the script is usable on Unix.
Try this:
1) can you cat the file?
2) if yes, do " cat file > newfile"
This may sound stupid, but I faced similar poblem on solaris, when I transfered a file over ftp from a linux box. This also happend when I used Copy and Past in vi.
try to execute the newfile...

Best of luck
Can you post the expect script? Did you find "goto" in the script? I think some where the code in the script was broken. Some where the script try to run ksh. Look the following test I did:  

$ more ./tt

$ ./tt
../tt[2]: goto:  not found
$ ksh goto
ksh: goto:  not found

The tt ksh script only contains "goto". When I run it, it display the script name. When you run "ksh goto", you get the error of "ksh: goto:  not found."

Hope this helps.
rigsbyAuthor Commented:
Comment accepted as answer
rigsbyAuthor Commented:
Many thanks Chris ...... sorry took so long!!!!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.