![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
lavender136
这个作者很懒,什么都没留下…
展开
-
shell案例
set -x n=1 while [ 10 -gt $n ] do echo "$n" n=`expr $n + 1` done for variables in list_of_iterms do command1 command2 done world=$1 if [ -n "$world" ];then echo "world长度大于零" else if [ ! -n "$worl...原创 2018-09-21 20:34:02 · 145 阅读 · 0 评论 -
shell命令
查看当前可使用shell: cat /etc/shells 查看当前系统使用的shell : echo $SHELL 环境变量:1 对所有用户生效 /etc/profile 2:对当前用户生效 $HOME/.bash_profile 变量用"="连接值,等号两侧不可有空格 将一个命令的结果赋给一个变量两种方式 1: A=`ls -al` 2: A=$(ls -al) 单引号会对所有特殊字...原创 2018-09-21 20:36:11 · 163 阅读 · 0 评论 -
shell基础
$ cd `dirname $0` 和PWD%/* shell变量的一些特殊用法 在命令行状态下单纯执行 $ cd `dirname $0` 是毫无意义的。因为他返回当前路径的"."。这个命令写在脚本文件里才有作用,他返回这个脚本文件放置的目录,并可以根据这个目录来定位所要运行程序的相对位置(绝对位置除外)。 在/home/admin/test/下新建test.sh内容如下: cd `dirn...转载 2018-11-08 17:19:53 · 71 阅读 · 0 评论 -
日志分析命令
$ find ./ -name 'app_20181220.log'|xargs grep XXXXX|grep 'XXXXXX'|awk -F "," '{print $6}'|sort|uniq -c | more 1334 errorMessage: 84 errorMessage:ERROR status:502 270 errorMessage:Read tim...原创 2018-12-21 10:42:06 · 90 阅读 · 0 评论 -
awk学习
awk是行处理器: 相比较屏幕处理的优点,在处理庞大文件时不会出现内存溢出或是处理缓慢的问题,通常用来格式化文本信息 awk处理过程: 依次对每一行进行处理,然后输出 awk命令形式: awk [-F|-f|-v] ‘BEGIN{} //{command1; command2} END{}’ file [-F|-f|-v] 大参数,-F指定分隔符,-f调用脚本,-v定义变量 var=...转载 2018-12-21 14:41:33 · 119 阅读 · 0 评论