Sunday, May 19, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 2591  / 2 Years ago, tue, december 21, 2021, 1:27:41

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?


already newest version


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


installed, anaconda path


More From » command-line

 Answers
7

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'

[#1512] Tuesday, December 21, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bsorbedeldy

Total Points: 315
Total Questions: 110
Total Answers: 108

Location: Reunion
Member since Mon, Dec 28, 2020
3 Years ago
;