2022年5月13日
摘要: while语法结构while argument; do statement ...done常见用法无限循环。while中的无限循环使用((1))或者[ 1 ]来实现.示例:时间打印while ((1)); do echo `date '+%Y-%m-%d %H:%M:%S'` sleep 1done 阅读全文
posted @ 2022-05-13 12:16 胖娃 阅读(518) 评论(0) 推荐(0)
摘要: 1、创建并运行第一个 shell 脚本2、将 shell 脚本转换为 bash 脚本3、为什么大多数 shell 脚本都包含 #! /bin/bash 在 shell 脚本的开头?4、将 shell 脚本添加到 PATH(以便它可以从任何目录运行)1、创建并运行第一个 shell 脚本首先创建一个名 阅读全文
posted @ 2022-05-13 12:12 胖娃 阅读(2432) 评论(0) 推荐(0)
摘要: 问题运行报错:./xxx_Config.sh: line 344: [: !-e: unary operator expected 问题原因分析shell 脚本中设计中,关系运算符与算术运算符的区别 //关系运行算:错误写法=》if [ !-e $xxx_CONFIG ]; then -e 代表文件 阅读全文
posted @ 2022-05-13 11:54 胖娃 阅读(1949) 评论(0) 推荐(0)
摘要: Shell if else语句if 语句通过关系运算符判断表达式的真假来决定执行哪个分支。Shell 有三种 if ... else 语句: if ... fi 语句;if ... else ... fi 语句;if ... elif ... else ... fi 语句。 1) if ... el 阅读全文
posted @ 2022-05-13 11:51 胖娃 阅读(3586) 评论(0) 推荐(1)
摘要: SHELL的条件判断: if list then do something here elif list then do another thing here else do something else here fi EX1: #!/bin/sh SYSTEM=`uname -s` #获取操作系 阅读全文
posted @ 2022-05-13 11:22 胖娃 阅读(1436) 评论(0) 推荐(0)
摘要: 下载:apt install xdotool 脚本(sleep每3秒点击一次):vim xdotool.sh #!/bin/bashwhile truedo x=`xdotool getmouselocation | awk -F '[a-z]:+' '{printf $2}'` y=`xdotoo 阅读全文
posted @ 2022-05-13 11:13 胖娃 阅读(302) 评论(0) 推荐(0)
摘要: 字符串列表定义方法1: a=(f1 f2 f3 f4)for i in ${a[*]}#遍历每一个列表值 for i in ${a[@]}#等价与上一句 实例: #!bin/basha=(f1 f2 f3 f4)for i in ${a[*]}; doecho ”$i“if [ "$i" == "f 阅读全文
posted @ 2022-05-13 11:11 胖娃 阅读(746) 评论(0) 推荐(0)
摘要: xdotool是linux下,类似”按键精灵“的工具,在一些自动测试时,经常用到 以上为xdotool正常使用 比如说: 模拟击键a xdotool key a 模拟两个键alt+tab xdotool key alt+Tab 自动输入word xdotool type 'word' 模拟鼠标移动+ 阅读全文
posted @ 2022-05-13 11:09 胖娃 阅读(5495) 评论(0) 推荐(1)