How to automate running this shell script that installs some software?


I have a shell script that installs some software I need to run my tests successfully. I can download that shellscript with wget and then execute it - but unfortunately there are no parameters to skip input - I have to page through a licence and then type “yes” a few times.

How can I automate this input, so the shell script can successfully run and install the software?


Probably a duplicate of this question.


Thanks, I will see if there is an undocumented --yes param and try to use yes | command.


No --yes option.
Running yes | sudo sh doesn’t work for the licence terms, when I confirm those manually nothing happen on actual prompt that would need “yes”.


Note: This does not actually automate input, but gives me a workaround where no input is necessary :slight_smile:

Trying --yes gave me this interesting output:

$ sudo sh --yes
Unrecognized flag : --yes
Makeself version 2.1.4
 1) Getting help or info about :
 2) Running : [options] [--] [additional arguments to embedded script]
  with following options (in that order)
  --confirm             Ask before running embedded script
  --noexec              Do not run embedded script
  --keep                Do not erase target directory after running
			the embedded script
  --nox11               Do not spawn an xterm
  --nochown             Do not give the extracted files to the current user
  --target NewDirectory Extract in NewDirectory
  --tar arg1 [arg2 ...] Access the contents of the archive through the tar command
  --                    Following arguments will be passed to the embedded script

By using --target and --noexec I could extract the content into a folder, without executing the script at the same time:

sudo sh --target=foo --noexec

This directory foo now contains:

-rwxr-xr-x 1 root root 2633 Okt 27 04:59
drwxr-xr-x 5 root root 4096 Dez 15 19:36 foo
-rw-r--r-- 1 root root  11565 Dez 15 19:42 License.txt
-rw-r--r-- 1 root root  135 Okt 27 04:59 Welcome.txt contains code like this:

more License.txt
while [ x$agreed = x ]; do
    echo "Do you agree to the above license terms? [yes or no] "
    read reply leftover
    case $reply in
        y* | Y*)
        n* | N*)
    echo "You must agree to the license agreement to install this software!";
    exit 1;;

which is the prompt I had problems with as it would page - and now I could just remove by opening the file with sudo gedit

(Removing those lines can be scripted with sudo sed -e '2d;12,27d;57d' which removes lines 2, 12 to 27 and 57)

(Alternatively I could also have extracted the actual installation logic from there and put this into my step, but removing some lines seems simpler)

Now running sudo ./ in that folder installs the software as it should.

Or from my config.yml:

      - run:
          name: Install additional dependency 
          command: |
            cd /tmp
            sudo sh --target foo --noexec
            cd foo
            sudo sed -e '15,43d' -i
            sudo ./


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.