Jonathan Kittell
Jonathan Kittell

Reputation: 7493

Bundle Expect with shell script to bypass installation of Expect

I want to create a shell script that uses the Expect library however Expect is not installed on any of the systems where I want to run the script. I also cannot install the library on these systems either. Can I build Expect from source and then put in same directory as the script? How would you go about this?

Upvotes: 0

Views: 357

Answers (1)

rsm
rsm

Reputation: 2560

Yes you can, and it's not difficult.

  1. Download Expect sources from https://sourceforge.net/projects/expect/files/latest/download?source=files

  2. Unpack sources

    gunzip expect.tar.gz
    tar -xvf expect.tar
    

This will create a directory containing the Expect distribution. Change to that directory and

  1. Configure sources for compilation:

    ./configure --prefix=~/
    

With --prefix parameter you specify where Expect should be installed. ~/ in my example is a shortcut for current user home directory, so it will be installed locally for your user only and you don't need root privileges this way to install it. In case you have root privileges and want to install it system-wide, you can omit --prefix parameter.

  1. Compile Expect:

    make
    
  2. And install it:

    make install
    

And that's it :)

Upvotes: 1

Related Questions