快速查询日志命令 发表于 2020-05-20 | 更新于 2020-05-21 | 分类于 Linux | | 阅读次数: ./tail.sh filename linenumber seratchText123456789101112131415161718192021222324252627282930313233#字体颜色blue_font="\E[34m\033[01m"green_font="\033[1;32m"yellow_font="\033[33m"light_green_font_withbackcolor="\033[42;30m\033[01m"light_green_font="\033[32m\033[01m"red_font="\033[1;31m"color_end="\033[0m"#参数校验if [ ! -n "$1" ] ;then echo -e "${blue_font} 请指定日志文件目录 ! ${color_end}" exit 1; fi line=$2 if [ ! -n "$2" ] ;then line=20 fi if [ ! -n "$3" ] ;then echo -e "${yellow_font} 执行:tail -"$line"f $1 ${color_end}" tail -"$line"f $1 else echo -e "${yellow_font} 执行:tail -"$line"f $1 |grep "$3" ${color_end}" tail -"$line"f $1 |grep "$3" fi 相关文章 Linux Top命令 Linux 常用命令 Linux时区更改 Linux系统配置 常见问题汇总 打赏 微信支付 支付宝