Linux系统用bash制作录制回放功能脚本

今天看到一个有趣的脚本,放在这里分享一下

转子:https://www.jb51.net/article/130973.htm


#!/bin/bash
# Filename:Record.sh

read -p "Please input the sesson filename you want to creat: " filename;

sesfile="$filename.session"
logfile="$filename.timing.log"

if [ -e $sesfile ];then
  echo "$sesfile is Exsit,Creat session file fault!";
  read -p "If you want to reload the file? [Y/N]: " flag;
  if [ "$flag" = "Y" ];then
    rm $sesfile $logfile;
    script -t 2> $logfile -a $sesfile;
  else
    echo "Nothing to do!";
  fi

else
  script -t 2> $logfile -a $sesfile;
fi

#!/bin/bash
# Filename:Replay.sh

read -p "Please input the session filename: " filename
logfile="$filename.timing.log"
sesfile="$filename.session"
if [ -e $sesfile ]; then
  scriptreplay $logfile $sesfile
  echo
else
  echo "$filename is NOT Exsit!"
fi

再补一个TermRecord方法,TermRecord是python编写的脚本,所以,linux环境里必须有python及web环境

pip install TermRecord
TermRecord -o /path/filename_html
停止录制,键入 exit

在web浏览器中打开filename_html就可以看到输出结果
做了个例子,大家可以看看
https://techlife.com.cn/190812.html

原创文章,转载请注明: 转载自混沌

本文链接地址: Linux系统用bash制作录制回放功能脚本