linux之while循环
来源:互联网 发布:苹果电脑拼图软件 编辑:程序博客网 时间:2024/05/29 14:32
[root@localhost rootCodeFiles]# cat while_test.sh #!/bin/shnum=1while [ $num -le 10 ]do SUM=`expr $num \* $num` echo $SUM num=`expr $num + 1`done[root@localhost rootCodeFiles]#
[root@localhost rootCodeFiles]# cat user_add.sh #!/bin/sh#批量添加用户echo "please input username"read usernameecho "please input num"read num# /etc/passwd 添加用户名i=1while [ $i -le $num ]do /usr/sbin/useradd $username$i i=`expr $i + 1`done# /etc/shadow 给用户设置密码echo "please input password"read passwdj=1while [ $j -le $num ]do echo $passwd | /usr/bin/passwd --stdin $name$j > /dev/null j=`expr $j + 1`done [root@localhost rootCodeFiles]#
[root@localhost rootCodeFiles]# cat user_delete.sh #!/bin/shecho "please input username"read usernameecho "please input number of user you wanna delete"read numsum=1while [ $sum -le $num ]do /usr/sbin/userdel -r $username$sum sum=`expr $sum + 1`done[root@localhost rootCodeFiles]#
0 0
- linux之while循环
- Linux命令之while - Bash中的While循环
- Linux命令之while - Bash中的While循环
- Linux学习之while循环与until循环
- Linux shell 编程之while循环、until循环
- linux while循环
- 循环结构之 while循环
- 循环之while
- javascript之while循环
- Python之While循环
- Linux之Shell脚本while循环ssh登录执行命令
- linux 命令系列之 while循环和until循 (63)
- Linux 下的 shell 编程之 while 循环
- Linux Shell系列教程之(十一)Shell while循环
- linux 下的Shell编程之while、until循环
- linux基本操作---shell编程之 while循环
- 我使用过的Linux命令之while - Bash中的While循环
- linux shell编程while循环
- 扩展欧几里得算法
- nginx与lua的执行顺序和步骤说明
- Lisp入门
- 坚持#第61天~第一个自制网页完成啦!(独立纯手写)
- windows下安装github for windows和SourceTree
- linux之while循环
- HDU 3555 数位DP
- 1、Hessian入门
- eclipse导入外部项目tomcat无法识别
- 字符编码之ASCII编码
- 1613-3-傅溥衍 总结《2016年10月8日》【连续第八天总结】
- [python官方文档]5数据结构
- 文字转载-《 我忍你,一辈子》
- 校园网用户出现“此计算机当前已将连接限制为”的可能解决方案