Просто используйте:
script logfilename install.sh
, когда install.sh завершил выполнение, script
также завершится - так что вы получите все, что вошли в logfilename
.
Возможно, выможно сделать его двухэтапным, поэтому вы должны переименовать ваш текущий install.sh
в install-stage2.sh
, и ваш install.sh будет содержать:
script ./install.log ./install-stage2.sh
UPDATE из моего man script
NAME
script -- make typescript of terminal session
SYNOPSIS
script [-akq] [-t time] [file [command ...]]
DESCRIPTION
The script utility makes a typescript of everything printed on your terminal. It is useful for students who need
a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out
later with lpr(1).
If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is
saved in the file typescript.
If the argument command is given, script will run the specified command with an optional argument vector instead
of an interactive shell.