随笔分类 -  linux&&Shell&&Cmd

摘要:!/bin/bash source ${HOME_DIR}/script/ideploy_dm.inc source ${HOME_DIR}/script/comm_lib home_dir=$(cd ; pwd) 脚本执行的输出日志 logFile="./cmi_data_process.log" 阅读全文
posted @ 2018-04-27 19:04 Desneo 阅读(384) 评论(0) 推荐(0)
摘要:if [ command ];then 符合该条件执行的语句 elif [ command ];then 符合该条件执行的语句 else 符合该条件执行的语句 fi 19. 定时任务 crontab 19.1 注意点 12 1 scp下载上传文件 阅读全文
posted @ 2018-01-17 18:57 Desneo 阅读(238) 评论(0) 推荐(0)
摘要:1.常用汇总 2. profile/baserc等配置文件的加载顺序 3. 不同用户使用不同jdk 思路:用户.bashrc中配置文件覆盖全局/etc/profile中的配置项 阅读全文
posted @ 2017-09-14 14:14 Desneo 阅读(211) 评论(0) 推荐(0)
摘要:1. 常用点 //bat文件执行后不消失 尾行添加pause echo "%cd%" //查看环境变量值 set //显示所有环境变量 2. 变量 set "CURRENT_DIR=%cd%" //设置变量 cd "%CURRENT_DIR%" //引用变量 2.1 系统预定义变量 %CD% 扩展到 阅读全文
posted @ 2017-07-21 12:57 Desneo 阅读(175) 评论(0) 推荐(0)
摘要:find ./ name "test.txt" 示例 find . ( name " .txt" o name " .pdf" ) print //查找txt和pdf文件 find . regex ". (.txt|.pdf)$" //按正则查找 find . ! name " .txt" prin 阅读全文
posted @ 2017-07-20 17:28 Desneo 阅读(562) 评论(0) 推荐(0)
摘要:grep r bes.dsf.server.zookeeper ./ //递归搜索,不支持指定文件类型 find ./ name " .entity.xml" exec grep r paymentMode {} \; //指定类型文件中搜索,必须\;结尾 grep a 'querySubscrib 阅读全文
posted @ 2017-07-20 17:27 Desneo 阅读(246) 评论(0) 推荐(0)
摘要:1. 格式 格式: awk 'pattern {action} pattern {action}' filename 注:多个文件时,读取从左到右,读完第一个再读取第二个 pattern 1 /正则表达式/:使用通配符的扩展集。 2 关系表达式: 可以是字符串或数字的比较,如$2 $1选择第二个字段 阅读全文
posted @ 2017-07-20 17:26 Desneo 阅读(1026) 评论(0) 推荐(0)
摘要:sed option 'action' filename (文件可多个) option: i 直接在原文件中修改! n 安静模式,默认情况所有数据都会被列出,但 n只有经过动作处理的那一行才被列出(结合p使用) 2. 选项 action 动作:'[n1[,n2]]function' 表示对n1、n2 阅读全文
posted @ 2017-07-20 17:26 Desneo 阅读(2822) 评论(0) 推荐(0)
摘要:1. 文件操作 1.1 获取文件头/文件尾 head 100 catanila.out temp.log tail f oc.logs tail 100 oc.log 1.2 合并文件 cat .txt test.txt 1.3 清空文件 echo "" oc.log 1.4 创建文件 touch 阅读全文
posted @ 2017-07-20 17:22 Desneo 阅读(739) 评论(0) 推荐(0)
摘要:1. 基础 2. 变量 (不要空格) 2.2 获取、设置环境变量 2.3 Shell特殊变量 3. 数组和循环 声明: array=(element1 element2 element3 .... elementN) //()括起来 空格分开 读取: echo ${array[0]} 遍历: ${a 阅读全文
posted @ 2017-07-20 17:17 Desneo 阅读(271) 评论(0) 推荐(0)
摘要:特殊字符 (转义字符)若要匹配这些特殊字符之一,在字符前面加反斜杠字符 (\)。 例如,若要搜索“+”文本字符,可使用表达式“\+”。 |元字符|行为|示例 | |: |: | | |零次或多次匹配前面的字符或子表达式。 等效于 {0,}。|zo 与“z”和“zoo”匹配。| |+|一次或多次匹配前 阅读全文
posted @ 2017-07-20 17:15 Desneo 阅读(2346) 评论(0) 推荐(0)