如何解决运行各种安装脚本时登录终端
| 我已经在Shell中编写了一个安装脚本,该脚本对xserver,network等各种事物进行了一些配置,然后安装了一些RPM \,这是没有问题的。但是我也希望能够记录到终端屏幕的所有内容。是否可以在脚本中执行此操作,因此如果最终用户运行./Install.sh,它将执行所有操作(包括日志记录)。 我尝试使用\“ script \”,但在Install.sh脚本本身中无法使用。 谢谢解决方法
只需使用:
script logfilename install.sh
当install.sh完成运行时,ѭ1也结束了-因此,您将所有内容登录到logfilename
中。
可能您可以将其分为两个阶段,因此,应将当前的install.sh
重命名为install-stage2.sh
,然后install.sh将包含:
script ./install.log ./install-stage2.sh
我的ѭ6的更新
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.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。