![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
shell编程
EmDongJO
print('好好学习 天天向上')
展开
-
shell-for循环嵌套使用
#!/bin/bashIPDuMax=255;for((i=1;i<=$IPDuMax;i++));do for((j=1;j<=$IPDuMax;j++)); do if [[ "$j" -eq "255" ]]; then echo "192.168.""$i"."$j" else echo -n "192.168.""$i"."$j""," fi donedone~原创 2020-06-24 17:51:38 · 6896 阅读 · 0 评论 -
shell-打印linux所有用户
#!/bin/bashlineNum=`cat /etc/shadow | wc -l`;#echo $lineNum;i=0;while [ "$i" -lt $(($lineNum+0)) ];do i=`expr $i + 1`; a=`sed -n "$i"p /etc/shadow`; if [[ $i -eq $(($lineNum+0)) ]]; then echo -n ${a%%:*}; else echo -n ${a%%:*}",";原创 2020-06-24 17:11:05 · 390 阅读 · 0 评论 -
shell-切割字符串处理
切割字符串处理&简单加法运算实例# 字符串currentNum1="10asddddzcxxx";remainInfo="1312 /root/testfile";# 切割字符串,识别字符串中符合0-9的数字,并删除不符合条件的内容currentNum2=`echo $currentNum1 | tr -cd "[0-9]" `;# 切割字符串,识别特整字符串段并将其删除${remainEventInfo%% *}# $currentNum1+0 强制类型转换$currentNum原创 2020-06-24 13:46:58 · 234 阅读 · 0 评论