
shell
learnbigger
终身学习者
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
shell 遍历文件夹并scp文件
#!/bin/bashfor file in /root/testdatas/*do if test -f $file then arr=(${arr[*]} $file) fidone#echo ${arr[@]}for i in ${arr[@]}do #echo $i scp $i slave:/root/testdatas/done...原创 2018-04-21 23:52:10 · 1922 阅读 · 0 评论 -
crontab定时任务
1,编辑命令 crontab -e*/1 * * * * sh ~/b.sh 保存退出即可b.sh #!/bin/bashecho hello >> ~/test.txt2,查看crontab crontab -l3,查看执行结果tail -f test.txt原创 2018-04-22 22:56:45 · 184 阅读 · 0 评论 -
ssh相关
1:ssh-keygen -t rsa2:ssh-copy-id -i ~/.ssh/id_rsa.pub jifeng@jifeng023,指定或映射过的端口:注意引号ssh-copy-id -i ~/.ssh/id_rsa.pub "-p 23 jifeng@jifeng03"scp:scp -P22 $local_radius/$fileName.txt greenet@greenet:$...原创 2018-04-24 19:10:41 · 133 阅读 · 0 评论 -
shell脚本的空格
https://www.cnblogs.com/matthewma/p/6995479.html基本语法 shell的if语法和C语言等高级语言非常相似,唯一需要注意的地方就是shell的if语句对空格方面的要求比较严格(其实shell对所有语法的空格使用都比较严格),如果在需要空格的地方没有打上空格,都会报错。如if [ $1x == "ip"x ];then echo "abc";fi中...转载 2018-04-26 09:19:34 · 1235 阅读 · 0 评论 -
shell字符串拼接,返回值问题
#!/bash/sh function f(){ find ./ -name $1'*.'$2 #有的命令需要''连接,有的不需要 ls -tr $1/$2*.$3 | head -$4 } result=`f a txt` echo $result for x in $result do echo $x done #传入的函数的参数为数组时,函数内取值,注意*...原创 2018-04-26 13:10:42 · 1119 阅读 · 0 评论