![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
tiandaochouqin99
这个作者很懒,什么都没留下…
展开
-
【shell】判断是否可以免密码登陆
更新ssh key的脚本,供参考#!/bin/bash#install ssh-key to the hosthostno=$1passwd=xxxxxindicate_msg(){ msg=$1 echo ">>>>>>>>>>>>>>>>>>...原创 2019-11-22 16:27:31 · 1278 阅读 · 0 评论 -
【shell】Xargs用法详解
简介之所以能用到这个命令,关键是由于很多命令不支持|管道来传递参数,而日常工作中有有这个必要,所以就有了xargs命令,例如:这个命令是错误的find /sbin -perm +700 |ls -l这样才是正确的find /sbin -perm +700 |xargs ls -lxargs 可以读入 stdin 的资料,并且以空白字元或断行字元作为分辨,将 stdi...转载 2017-08-04 17:29:32 · 272 阅读 · 0 评论 -
【shell】在sed中引入shell变量的四种方法
今天在写一个脚本遇到问题,----需要在sed中引入shell变量,在网上搜了变天才找到,经过测试这四种方法都可用,在这里跟大家分享下,=---同时谢谢netman大哥,前辈就是前辈哈哈1.eval sed ’s/$a/$b/’ filename2.sed "s/$a/$b/" filename3.sed ’s/’$a’/’$b’/’ filename4.sed s/$a/$b/ ...转载 2017-10-12 16:54:31 · 2165 阅读 · 0 评论 -
【shell】按行读文件
#!/bin/bash echo "##### 方法 1 #####"while read line1do echo $line1done < $1 echo "##### 方法 2 #####"cat $1 | while read line2do echo $line2done echo "##### 方法 3 #####"for line3 in $(...转载 2019-07-24 19:22:33 · 140 阅读 · 0 评论 -
【shell】xargs
复制所有图片文件到 /data/images 目录下:ls *.jpg | xargs -n1 -I cp {} /data/images转自:http://man.linuxde.net/xargs原创 2019-07-24 19:23:51 · 359 阅读 · 0 评论 -
【shell】vim 替换
1. 替换1.1 光标所在行的替换其中,,s表示插入,g表示当前行查找:s/abc/xyz/g1.2 全文替换其中,1表示第1行,$表示最后1行:1,$s/abc/xyz/g其中,%表示全文:%s/abc/xyz/g1.3 转义替换其中, S.替换为S->此处因为点号“.”为特殊匹配符,在正则中表示单个字符,所以如果想匹配点号,就需要把“\...转载 2019-08-30 15:11:58 · 691 阅读 · 0 评论 -
【shell】vim插入 删除
1. 插入1.1 全文行首插入其中,%表示全文, s表示插入,^表示行首,your_word表示插入的内容:%s/^/your_word/1.2 全文行末插入其中,%表示全文,s表示插入,$表示行末,your_word表示插入的内容:%s/$/your_word/1.3 指定行插入1.3.1 其中, 52,55表示从第52行到55行进行操作:52, 55s...转载 2019-08-30 15:24:45 · 410 阅读 · 0 评论