随笔分类 - shell
摘要:例:ip=$(hostname -i) 和 ip=(`hostname -i`) 都能得到 ip
阅读全文
摘要:知识点:shell cut分割获取内容 1. cut -b 以字节为单位进行分割 以who命令为例 2. cut -c 以字符为单位进行切割 与 cut -b 基本相同,但是cut -c 可以切割中文,-b有时候可能为乱码 3. cut -d -f 按区域切割 参考文档: https://blog.
阅读全文
摘要:大于 -gt (greater than) 小于 -lt (less than) 大于或等于 -ge (greater than or equal) 小于或等于 -le (less than or equal) 不相等 -ne (not equal) if [ -z $n1 ] :-z 空的意思 即
阅读全文
摘要:运行脚本,第一个位置参数只能是master或者join 第二个位置参数只能是内网ip 第三个参数默认是False,如果是True,激活第四个位置参数,其余参数出错 第四个参数是一个外网ip 简单地讲,内网IP有3种:第一种10.0.0.0~10.255.255.255,第二种172.16.0.0~1
阅读全文
摘要:命令: ssh 用户名@ip "cat /etc/*-release |grep -i PRETTY_NAME |cut -b 14-25 | sed 's/ //g' | tr '[:upper:]' '[:lower:]'" 结果: 解析: 1. ssh omnisky@ip:做免密 2. ca
阅读全文

浙公网安备 33010602011771号