Can't Find Package Expect While Executing "Package Require Expect"

I want to use autoexpect for a simple .sh file but the terminal shows this error:

can't find package Expect
    while executing
"package require Expect"
    (file "/usr/bin/autoexpect" line 6)

my terminal command is:

autoexpect shell.sh

I remove expect and install it again but no difference with past!

Can anyone help me?

This is output of dpkg -l | grep tcl; which tclsh; which tclsh8.6; dpkg -S Expect; echo $PATH. Does Anaconda contradict expect?

0

1 Answer

You have to install the main Expect package by

sudo apt-add-repository universe
sudo apt-get install expect

and it will install tcl-expect as dependency for you.

To run Expect scripts avoiding problems with Anaconda you have to manually specify PATH variable and then run your expect/tcl script:

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
autoexpect ./shell.sh

or in one line:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin autoexpect ./shell.sh

To ease every autoexpect command execution you can add the following alias to the ~/.bashrc:

alias autoexpect='PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin autoexpect'
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest