当前位置:网站首页>shell脚本
shell脚本
2022-08-10 21:25:00 【白给超人】
目录
矩形
!/bin/bash
for ((a=1;a<=9;a++))
do
for ((b=1;b<=9;b++))
do
echo -n "*"
done
echo ""
done
直角三角形
#!/bin/bash
for ((a=1;a<=9;a++))
do
for ((b=1;b<=a;b++))
do
echo -n " "
done
for ((c=9;c>=a;c--))
do
echo -n "*"
done
echo ""
done
等腰三角形
#!/bin/bash
for ((a=1;a<=9;a++))
do
for ((b=9;b>=a;b--))
do
echo -n " "
done
#c=$[$a*2-1]
for ((c=1;c<=$[$a*2-1];c++))
do
echo -n "*"
done
echo ""
done
梯形
#!/bin/bash
for ((a=1;a<=9;a++))
do
for ((b=9;b>=a;b--))
do
echo -n " "
done
for ((c=1;c<=a;c++))
do
echo -n "*"
done
for ((d=1;d<=3;d++))
do
for ((e=1;e<=3;e++))
do
echo -n "*"
done
echo -n ""
done
echo ""
done
菱形
#!/bin/bash
for ((a=1;a<=9;a++))
do
for ((b=9;b>=a;b--))
do
echo -n " "
done
#c=$[$a*2-1]
for ((d=1;d<=$[$a*2-1];d++))
do
echo -n "*"
done
echo ""
done
for ((e=10;e>=1;e--))
do
for ((f=9;f>=e;f--))
do
echo -n " "
done
for ((g=1;g<=$[$e*2-1];g++))
do
echo -n "*"
done
echo ""
done
查看主机信息
#!/bin/bash
name=`hostname`
ip=`ifconfig ens33|awk /netmask/'{print $2}'`
os=`cat /etc/redhat-release`
kernel=`uname -r`
cpu=`lscpu|grep 型号名称:| tr -s " "| cut -d":" -f2`
mem=`free -hm |awk /Mem/'{print $2}'`
space=`lsblk |awk /disk/'{print $4}'|awk -F G '{print $1}'`
for i in $space
do
let sum=$[ $sum+$i ]
done
echo -e "$B主机名:$name"
echo -e "${B}IP地址:$ip"
echo -e "$B系统版本:$os"
echo -e "$B内核版本:$kernel"
echo -e "${B}cpu名称:$cpu"
echo -e "$B内存总大小:$mem"
echo -e "$B硬盘总大小:$space"
边栏推荐
- LeetCode-498 - Diagonal Traversal
- C. Even Picture
- 函数:函数删除操作语法&使用例——《mysql 从入门到内卷再到入土》
- These must-know JVM knowledge, I have sorted it out with a mind map
- Intelligent scheme design - intelligent rope skipping scheme
- labelme-屏蔽拖拽的事件
- C # Hex file transfer skills necessary article 】 【 bin file code implementation
- Use Cloudreve to build a private cloud disk
- FPGA - 7系列 FPGA内部结构之Memory Resources -03- 内置纠错功能
- MySQL高级指令
猜你喜欢
随机推荐
shell(文本打印工具awk)
国内Gravatar头像的完美替代方案Cravatar
每次打开chrome会跳出What's new
变量和它的特性——《mysql 从入门到内卷再到入土》
How to secure users in LDAP directory service?
ENVI最小距离、最大似然、支持向量机遥感影像分类
ENVI自动生成地面控制点实现栅格影像的自动地理配准
labelme-屏蔽拖拽的事件
黑猫带你学Makefile第12篇:常见Makefile问题汇总
2022.8.8好题选讲(数论场)
带你一文读懂SaaS版多租户商城系统对多品牌企业的应用价值
labelme - block drag and drop events
C. Social Distance
SELECT:简单的查询操作语法&使用例——《mysql 从入门到内卷再到入土》
DELETE:删除操作语法&使用例——《mysql 从入门到内卷再到入土》
DDL:视图——《mysql 从入门到内卷再到入土》
Shell编程之条件语句(二)
C. Rotation Matching
【PCBA solution】Electronic grip strength tester solution she'ji
ThreadLocal全面解析(一)