• script


    一、简介

    1.应用:
      (1)调试终端会话
      (2)提供Shell教程
    2.命令
      (1)script录制击键和击键时机
      (2)scriptreplay可以回放该会话

    二、技巧

    1.录制终端会话

    [root@localhost 1]# script -t 2> time.log -a action.session
    Script started, file is action.session
    [root@localhost 1]# exit
    exit
    Script done, file is output.session

    说明:

      (1)-t   指明输出录制的时间数据。

          其中时序数据默认发送到stderr,应使用重定向2>到新文件中保存下来

      (2)-a  指明输出录制的方式为追加

      (3)exit 或 Ctrl+d 结束录制

      (4)time.log 和 action.session的名字、后缀可以任意起,通俗易懂即可。

    2.播放终端会话

    [root@localhost 1]# scriptreplay time.log action.session 

    说明:

      (1)-f  如果需要在输出到日志文件的同时,也可以查看日志文件的内容,可以使用 -f 参数。PS:可以用于教学,两个命令行接-f可以实时演示

      (2)-q      可以使script命令以静默模式运行

  • 相关阅读:
    自动生成 Makefile 的全过程详解
    cpio实例讲解
    RPM命令手册
    SSHFS
    shell脚本命令行参数传递问题
    批量改名总结
    例解 autoconf 和 automake 生成 Makefile 文件
    Shell中的shift命令
    cpio命令详解
    Git笔记基础
  • 原文地址:https://www.cnblogs.com/ytdyz/p/12643648.html
Copyright © 2020-2023  润新知