随笔分类 -  服务部署 / shell脚本

摘要:1. 获取某个文件夹下的所有文件名(含文件夹),并显示 #!/bin/sh # get the file name Folder_A="/home/youname/shell/gotfilename/bin" for file_a in ${Folder_A}/* do temp_file=`bas 阅读全文
posted @ 2021-12-08 17:30 慎终若始 阅读(11147) 评论(0) 推荐(0) 编辑
摘要:前言 搜索关键词 shell中第一行#!/bin/bash的作用 shell 是一种脚本语言。 脚本本质是一个文件,文件里面存放的是 特定格式的指令,系统可以使用脚本解析器 翻译或解析 指令 并执行(它不需要编译)。 shell 既是应用程序 又是一种脚本语言(应用程序 解析 脚本语言)。 作用 “ 阅读全文
posted @ 2021-12-08 14:10 慎终若始 阅读(2208) 评论(0) 推荐(0) 编辑
摘要:前言 bash shell 脚本的方法有多种,现在作个小结。假设我们编写好的shell脚本的文件名为hello.sh,文件位置在/data/shell目录中并已有执行权限。 方法一: 切换到shell脚本所在的目录(此时,称为工作目录)执行shell脚本:代码如下: cd /data/shell . 阅读全文
posted @ 2021-12-08 10:58 慎终若始 阅读(1314) 评论(0) 推荐(0) 编辑
摘要:前言 熟悉掌握常用shell命令,能熟练编写shell脚本。 一、shell脚本入门 参看链接:https://blog.csdn.net/weixin_43288201/article/details/105643692 二、常见语法 2.1关键词 1、echo echo命令的基本用法,很简单,就 阅读全文
posted @ 2021-09-12 19:53 慎终若始 阅读(240) 评论(0) 推荐(0) 编辑
摘要:1、脚本 #!/bin/bash for dir in `ls .` do if [ -d $dir ] then echo $dir tar -cvf $dir.tar $dir compress $dir.tar #scp $dir.tar 192.168.12.34:/opt/miracle/ 阅读全文
posted @ 2021-06-27 20:44 慎终若始 阅读(202) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示