zoukankan      html  css  js  c++  java
  • shell脚本,录制和回放终端的小工具script。

    action.log和time.log这两个配置文件被当做script命令的参数。这两个文件可以随便命名。
    这里用time.log和action.log。其中time.log用于存储时序信息,描述每一个指令在何时运行;
    action.log用于存储命令信息输出。-t选项用于将时序数据导入stderr。2>用于stderr重定向到time.log。
    [root@localhost ~]# script -a action.log  -t 2>time.log   
    Script started, file is action.log
    [root@localhost ~]# who
    (unknown) :0           2016-09-05 12:24 (:0)
    root     pts/0        2016-09-05 12:25 (192.168.1.79)
    root     pts/1        2016-09-05 12:44
    [root@localhost ~]# ls 
    0          1file.sh        3file.sh    anaconda-ks.cfg              clearlog.sh  fibo.sh  initial-setup-ks.cfg  m2.txt  m4.txt        time.log     yibai.sh    视频  音乐
    1          2016815.tar.gz  99.sh       apache-tomcat-7.0.70.tar.gz  copy.sh      file     m1                    m3      show          wenjian      yijiaer.sh  图片  桌面
    112233.sh  2file.sh        9file       a.txt                        create50.sh  file.sh  m1.txt                m3.txt  showdiff.sh   wyb          公共        文档
    1file      2five.sh        action.log  b.txt                        del50.sh     five.sh  m2                    m4      students.txt  yibaifor.sh  模板        下载
    [root@localhost ~]# date
    2016年 09月 05日 星期一 12:44:45 CST
    [root@localhost ~]# exit           #退出用ctrl+d 或是exit
    exit
    Script done, file is action.log
    [root@localhost ~]# scriptreplay time.log action.log   #敲回车后,就将自动回放你之前输入的操作了。
  • 相关阅读:
    一个基础的CURL类
    设计自适应网页方法
    JQ点击列表显示隐藏
    获取当前页面的完整URL
    配置时间生成下拉菜单
    Contains Duplicate II
    Rectangle Area
    面试题47:不用加减乘除做加法
    面试题48:用C++设计一个不能被继承的类
    Reverse Linked List
  • 原文地址:https://www.cnblogs.com/wangyuebo/p/5841887.html
Copyright © 2011-2022 走看看