Linux 初步学习

Linux 目录和 windows 目录有很大的不同,linux 目录类似一个树,最顶层是其根目录

/ [根目录] ->[bin][boot][dev][home][opt][mnt][root][usr][....]
/bin -> 二进制可执行命令
/etc -> 系统管理和配置文件
/etc/rc.d -> 启动的配置文件和脚本 
[init.d  rc0.d  rc1.d  rc2.d  rc3.d  rc4.d  rc5.d  rc6.d  rc.local]
/etc/init.d -> 需重点简介下
/home -> 用户主目录的宿主目录,比如一个用户的宿主目录 /home/user1
/lib -> 标准程序设计库,又叫动态链接共享库,作用类似windows里的.dll文件
/sbin 超级管理命令,这里存放的是系统管理员使用的管理程序

/sbin 超级管理命令,这里存放的是系统管理员使用的管理程序
/tmp 公共的临时文件存储点
/root 系统管理员的主目录
/mnt 系统提供这个目录是让用户临时挂载其他的文件系统
/lost+found这个目录平时是空的,系统非正常关机而留下“无家可归”的文件
/proc 虚拟的目录,是系统内存的映射.可直接访问这个目录来获取系统信息.
/var 某些大文件的溢出区,比方说各种服务的日志文件
/usr 最庞大的目录,要用到的应用程序和文件几乎都在这个目录,其中包含

/bin,/sbin,/usr/bin,/usr/sbin区别
/bin : commands in this dir are all system installed user commands系统的一些指令
/sbin:  commands in this dir are all system installed super user commands
[超级用户指令 系统管理命令,这里存放的是系统管理员使用的管理程序] 
/usr/bin: user commands for applications后期安装的一些软件的运行脚本
/usr/sbin: super user commands for applications 超级用户的一些管理程序
/usr/local/bin 本地增加的命令

[root@admin init.d]# service jboss7
This may be freely redistributed under the terms of the GNU Public License.
usage: /etc/init.d/jboss7 (start|stop|help|kill|killstart|version)
options:
start              Start jboss
stop               Stop jboss
status             JBoss status
kill               Forced to kill jboss process
killstart          Forced to kill jboss process, then start
version            Look at the version of the jboss
-help              Show this help message
[root@admin init.d]# service mysql start
Starting MySQL     [  OK  ]

[root@admin init.d]# cd /etc/rc.d/init.d
[root@admin init.d]# ls
myproxy  functions  jboss7  mysql  netconsole  network  nginx  README  tomcat7  tomcat8
[root@admin init.d]# cd /etc/init.d
[root@admin init.d]# ls
myproxy  functions  jboss7  mysql  netconsole  network  nginx  README  tomcat7  tomcat8

[ /etc/init.d 目录在 Linux 系统中可是很重要的,它只负责一键事情,但是涉及到全
  系统,它包含系统中各种服务的start|stop 脚本
  
/etc/init.d/command [option]  
command 指服务的命令,比如 buletooth,network,samba,ssh 等等
option  指命令方式 stop,start,status,kill 等等

比如重启 ssh 服务
#sudo /etc/init.d/ssh start
#service ssh stop

还有一中方式 service 关键字
service xxx 启动 /etc/init.d/ 目录下的xxx脚本
service vsftpd start  [===] /etc/init.d/vsftpd start

这里的命令类似 Windows 下 path 路径下的命令, [都是直接可以拿过来用的命令]
  
shell 基本编程要懂一下几点
1) shell if
2) shell for 循环
3) shell 数组

比如比较字符串,判断文档是否存在,文件是否可读,通常用"[]" 来表示条件测试
提醒下: 空格很重要。要确保方括号的空格
if ...; then ...  elif ...; then ... else ... fi   [if -> fi 这语句很奇特]
[ -f "file_txt"]: 判断是否是一个文件
[ -n "$var"]: 判断$var 变量是否有值
[ -x "/bin/ls"]: 判断/bin/ls是否存在并且有可执行权限
[ "$a" = "$b"]: 判断两个变量值是否相等
-r file     用户可读为真
-w file     用户可写为真
-x file     用户可执行为真
-f file     文件为正规文件为真
-d file     文件为目录为真
-s file     文件大小非0时为真
算术运算
-eq —比较两个参数是否相等(if [ 2 –eq 5 ])
-ne —比较两个参数是否不相等
-lt —参数1是否小于参数2
-le —参数1是否小于等于参数2
-gt —参数1是否大于参数2
-ge —参数1是否大于等于参数

[root@admin sbin]# whereis date
date: /usr/bin/date
[root@admin sbin]# date -d yesterday +%Y%m%d
20171201

判断文件是否存在
[
	#!/bin/sh
	YACCESS=`date -d yesterday +%Y%m%d`
	FILE="access_$YACCESS.log.tgz"

	cd /root/install
	if [ -f "$FILE" ]; then   
	   echo "ok"
	   else
	   echo "error $FILE" > error.log
	   mail -s "$FILE backup fail" qq@qq.com < error.log
	fi     
]

./a.sh: line 6: [: missing `]'
shell 文件运行时出现错误:[: missing `]'
代码中的 ] 方括号内部必须要有个空格,if [ ! -d $date] 改成 if [ ! -d $date ] 即可

[https://www.cnblogs.com/xuxm2007/archive/2011/10/20/2218846.html]
反引号位 (`) 位于键盘的Tab键的上方、1键的左方。注意与单引号(')位于Enter键的左方的区别。
在Linux中起着命令替换的作用。命令替换是指shell能够将一个命令的标准输出插在一个命令行中任何位置。
如下,shell会执行反引号中的date命令,把结果插入到echo命令显示的内容中。
[root@localhost sh]# echo The date is `date`
The date is 2011年 03月 14日 星期一 21:15:43 CST
  
单引号、双引号用于用户把带有空格的字符串赋值给变量事的分界符。
[root@localhost sh]# str="Today is Monday"
[root@localhost sh]# echo $str
Today is Monday
如果没有单引号或双引号,shell会把空格后的字符串解释为命令。
[root@localhost sh]# str=Today is Monday
bash: is: command not found
单引号和双引号的区别。单引号告诉shell忽略所有特殊字符,而双引号忽略大多数,但不包括$、\、`。
[root@localhost sh]# testvalue=100
[root@localhost sh]# echo 'The testvalue is $testvalue'
The testvalue is $testvalue
[root@localhost sh]# echo "The testvalue is $testvalue"
The testvalue is 100
 
shell 编程,符号的使用是很有讲究的,单引号,反单引号, 双引号, 不用引号 .......
Shell变量用双引号引起来,双引号就是表示这个双引号内为一个字符串。
对于 if 条件语句里所有的字符串的比较时,最好是在变量的外面加上双引号。
特别是 if -n 判断字符串是否为null时候(null意思就是字符串长度为0)一定要加上双引号,否则,像下面的case就会出错。
a=""
if [ -n $a ] 等价于 if[ -n ]
对于字符串长度为0时,相当于没有参数,这句总返回为真。明明a的为空串,长度为空,但是却判断出来为非空字符串。
改为if [ -n "$a" ]就没有此问题,可以判断出来为此为空字符串。
对于字符串的变量,一个比较特殊的情况,就是数组变量。这个时候变量外面不能用双引号,否则的话,shell会把双引
号里的内容当作一个字符串,而不会去以空格分割里面的内容。
arr="12 3 4 5"
for i in $arr  ---当数组用,所以不能加双引号
do
  echo $i
done
结果:1 / 2 / 3 / 4 /5
arr="12 3 4 5"
for i in "$arr" --加了双引号,就会将$arr的内容作为一个字符串一起输出
do
  echo $i
done
结果:1 2 3 4 5
所以,一般最好是加上双引号, 但是对于数组类型变量,不加双引号  
  
Shell 脚本中中括号“[]”判断问题
[http://blog.csdn.net/xiazhiyiyun/article/details/51436533]  
  

shell 中循环的写法:
# 第一类:数字性循环
for((i=1;i<=10;i++)); # 和 if 语句一样 条件完成之后要分号 
do
  echo $(expr $i \* 3 + 1);
done 
   
#!/bin/bash  
for i in $(seq 1 10)  
do   
echo $(expr $i \* 3 + 1);  
done 

#!/bin/bash
for i in {1..10}  
do  
echo $(expr $i \* 3 + 1);  
done

字符串类循环
#!/bin/bash
for i in `ls`;
do 
  echo $i is file name \!;
done 

#!/bin/bash 
for i in $* ;  
do  
echo $i is input chart\! ;  
done  
[root@admin-4 ss]# ./d.sh xi da afa
xi is file name !
da is file name !
afa is file name !

数组类循环
#!/bin/bash  
list="rootfs usr data data2"  
for i in $list;  
do  
echo $i is appoint ;  
done  

#!/bin/bash  
for file in /proc/*;  
do  
echo $file is file path \! ;  
done

#!/bin/bash
for file in $(ls *.sh)  
do  
echo $file is file path \! ;  
done  

1)循环结构中相互嵌套组成更复杂的流程,并结合break和continue可以实现很多复杂的运算。
2)可以结合其他语言的语法有助于更好的理解循环结构。
3)熟练应用还需要大量的重复练习,重写优秀的shell代码也是一种很好的方式。

linux中shell变量$#,$@,$0,$1,$2的含义解释
1) $$ shell 本身的PID (processID)
2) $! shell 最后运行的后台processID
3) $? shell 最后运行的命令的结束代码返回值
4) $* shell 所有的参数列表 以"$1 $2 … $n"的形式输出所有参数
5) $@ shell 所有的参数列表 以"$1" "$2" … "$n" 的形式输出所有参数
6) $# shell 脚本调用时参数的个数
7) $0 shell 本身的文件名称
8) $1 - $n  添加到Shell的各参数值。$1是第1参数、$2是第2参数…

systemctl 命令使用:[https://linux.cn/article-5926-1.html]


1) 检查某个单元或服务是否运行
2) 使用systemctl 控制并管理服务
3) 列出所有服务
4) Linux 中如何启动,重启,重载服务以及检查服务 (如httpd.service) 状态
5) 如何激活服务并在启动是启用或禁止服务 (即系统启动自动启动服务)
6) 如何屏蔽(让它不启动)或显示服务(如httpd.service)
7) 使用systemctl 命令杀死服务 

Systemctl 是一个 Systemctd 工具,主要负责控制 Systemctd 系统和服务管理器

Systemd是一个系统管理守护进程、工具和库的集合,用于取代System V初始进程。
Systemd的功能是用于集中管理和配置类UNIX系统

Systemd 如何控制系统和服务?
[root@admin ss]# systemctl --version
systemd 208

[root@admin ss]# whereis systemd
systemd: /usr/lib/systemd /etc/systemd /usr/include/systemd /usr/share/systemd
[root@admin ss]# whereis systemctl
systemctl: /usr/bin/systemctl /usr/share/man/man1/systemctl.1.gz
[root@admin ss]# 
[root@admin ss]# ps -eaf|grep sysemd
[root@admin ss]# systemd-analyze

重要:Systemctl接受服务(.service),挂载点(.mount),套接口(.socket)和设备(.device)作为单元
列出所有可用的单元:
[root@admin ss]# systemctl list-unit-files
列出所有运行中的单元
[root@admin ss]# systemctl list-units
检查某个单元是否启用
systemctl is-enabled crond.service
检查某个单元或服务是否运行
systemctl status firewalld.service
在Linux生态系统中,Systemd被部署到了大多数的标准Linux发行版中,
只有为数不多的几个发行版尚未部署。Systemd通常是所有其它守护进程的父进程

使用 Systemctl 控制并管理服务
systemctl list-unit-files --type=service

Linux 中如何启动,重启,停止,重载服务以及检查服务
#systemctl start httpd.service
#systemctl restart httpd.service
#systemctl stop httpd.service
#systemctl status httpd.service

当我们使用systemctl的start,restart,stop和reload命令时,
不会从终端获取到任何输出内容,只有status命令可以打印输出

如何激活服务并在启动时启用或禁用服务
#systemctl is-active httpd.service
#systemctl enable httpd.service
#systemctl disable httpd.service

#systemctl mask httpd.service
#systemctl unmask httpd.service
#systemctl kill httd

列出所有系统挂载点
#systemctl list-unit-files --type=mount

# systemctl start tmp.mount
# systemctl stop tmp.mount
# systemctl restart tmp.mount
# systemctl reload tmp.mount
# systemctl status tmp.mount

列出所有可用系统套接口
# systemctl list-unit-files --type=socket

# systemctl start cups.socket
# systemctl restart cups.socket
# systemctl stop cups.socket
# systemctl reload cups.socket
# systemctl status cups.socket

检查某个服务的所有配置细节
# systemctl show httpd

[root@admin ss]# systemctl show mysql
Id=mysql.service
Names=mysql.service
Requires=basic.target
Wants=system.slice
WantedBy=multi-user.target graphical.target
Conflicts=shutdown.target
Before=tomcat7.service tomcat8.service shutdown.target jboss7.service multi-user.target graphical.target
After=network.target remote-fs.target ypbind.service nscd.service ldap.service ntpd.service xntpd.service systemd-journald.s
Description=LSB: start and stop MySQL
LoadState=loaded

[root@admin ss]# systemctl show myproxy
Id=myproxy.service
Names=myproxy.service
Requires=basic.target
Wants=system.slice
WantedBy=multi-user.target
Conflicts=shutdown.target
Before=shutdown.target multi-user.target
After=network.target systemd-journald.socket basic.target system.slice

列出当前使用的运行级别:
[root@admin etc]# systemctl get-default
multi-user.target
启动运行等级5,即图形模式
# systemctl isolate runlevel5.target
# systemctl isolate graphical.target

Runlevel 0 : 关闭系统
Runlevel 1 : 维护模式
Runlevel 3 : 多用户,无图形系统
Runlevel 4 : 多用户,无图形系统
Runlevel 5 : 多用户,图形化系统 [VIP]
Runlevel 6 : 关闭并重启机器

# inittab is no longer used when using systemd.
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
# To view current default target, run:
# systemctl get-default
# To set a default target, run:
# systemctl set-default TARGET.target
systemd uses 'targets' instead of runlevels.
想改变模式,建立相应的软连接就可以了。
systemctl set-default multi-user.target  设定默认为字符界面,也就是3
systemctl set-default graphical.target   图形界面   5

让Linux启动时自动进入图形化界面方法:
编辑/etc/inittab文件,找到这行代码:id:3:initdefault:,它定义Linux进入系统后执行的init动作级别
共有以下6个级别:
级别0,挂起、关机模式;
级别1,单用户模式;
级别2,多用户模式,但没有网络功能;
级别3,全功能的单用户模式;
级别4,没用到;
级别5,X11模式,也就是图形化界面模式;
级别6,重起模式。
很明显,要自动进入图形化界面,将3改成5即可。注意千万不要设成0或6,否则Linux开机后进入系统
就会自动关机或自动重起

Linux系统图形界面和命令行界面之间的切换

一.系统不在虚拟机中的情况
  使用ctrl+alt+F1~6切换到命令行界面;ctrl+alt+F7切换到图形界面

二.系统在虚拟机中的情况
  Ctrl+Alt+shift+F1~6切换到命令行界面;使用Alt+F7返回到图形界面
(注:以上方法切换后,图形界面并没有关闭)

三.命令模式修改
 打开终端,输入init 3,回车即可。
 init 后数字的含义:
 0 - halt (Do NOT set initdefault to this)  //停机(不要把initdefault设置为零为0,因为这样会使Linux无法启动)
 1 - Single user mode  //单用户模式,就像WinXP下的安全模式
 2 - Multiuser, without NFS (The same as 3, if you do not have networking) //多用户,但没有NFS
 3 - Full multiuser mode  //完全多用户模式,标准的运行极,即命令行界面
 4 - unused   //一般不用,但在一些特殊情况下可以用他来做一些事情
 5 - X11      //选择此项,系统在登录时将进入图形化登录界面
 6 - reboot (Do NOT set initdefault to this)    
//重新启动(不要把initdefault设置为6,因为这样会使Linux不断重新启动)

四.每次启动直接进入字符界面,则要修改etc/inittab文件,将启动级别由5改为3即可
终端以root身份执行 vi /etc/inittab 打开inittab文件,编辑后保存重启即可
GTK、KDE、Gnome、XWindows 图形界面

chmod 755 $AGENT_PATH/script/*
chmod 755 $AGENT_PATH/script/syslog/*
chmod 755 $AGENT_PATH/script/ucarp/*.sh
cp $AGENT_PATH/myproxy.service /usr/lib/systemd/system
chmod 754 /usr/lib/systemd/system/myproxy.service
systemctl daemon-reload
systemctl enable myproxy.service  [添加开机启动服务]
systemctl enable ntpdate.service  [添加开机启动服务]
systemctl enable rsyslog.service  [添加开机启动服务]

[myproxy]
!/bin/bash
# myproxy Startup script for agent
#
# chkconfig: 2345 85 15
# description: agent.jar
#
# processname: myproxy
. /etc/rc.d/init.d/functions
AGENT_PATH=/opt/myapp/NE/agent
#export JAVA_HOME=/opt/myapp/3RD/jdk1.8
source /etc/profile
export CLASSPATH=${JAVA_HOME}/lib/:$CLASSPATH
export PATH=${JAVA_HOME}/bin:$PATH

export LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH}
cd $AGENT_PATH
case "$1" in
        start)
        		sh $0 stop
                sleep 1
                nohup java -Xmx256m -Xms256m -Xmn128m -XX:NewSize=128m -XX:MaxNewSize=128m -jar agent.jar >agent.out 2>error.out &
                echo $! > $AGENT_PATH/agent.pid
        ;;
        stop)
                id=`ps -ef | grep agent.jar |sed '/grep agent/ d'| awk '{print $2 }'`
		for pid in $id ; do
		echo --kill -9 $pid--
		if [ x"$pid" != x ] ; then
			kill -9 $pid
		fi
                done
        ;;
        restart)
                sh $0 stop
                sleep 1
                sh $0 start
        ;;
        log)
             tail -f $AGENT_PATH/agent.log
        ;;
        status)
                ps -ef|grep agent.jar
        ;;
        *)
                echo "Usage: myproxy {start|stop|restart|status}"
        ;;
esac
exit 0

[myproxy.service]
[Unit]
Description=myapp agent daemon
After=network.target

[Service]
Type=forking
ExecStart=/opt/myapp/NE/agent/myproxy start
ExecReload=/opt/myapp/NE/agent/myproxy restart
ExecStop=/opt/myapp/NE/agent/myproxy stop

[Install]
WantedBy=multi-user.target

--------------------------------------------------------------------------------------------------------------

#!/bin/bash
JAVA_PATH=/home/myapp/mydir
JAVA_HOME=$JAVA_PATH/jre
rm -rf $JAVA_HOME
if [ ! -d "/home/myapp" ];then
 mkdir "/home/myapp"
fi
if [ ! -d "/home/myapp/mydir" ];then
mkdir "/home/myapp/mydir"
fi
retval=$?
if [ "x$retval" == "x0" ];
then
  echo "EXEC OK" >> /var/log/jdk.log
else
  echo "EXEC fail" >> /var/log/jdk.log
fi

if [ -d $JAVA_HOME ] ; then
 rm -rf $JAVA_HOME
fi

ll=`uname -m`

if [ $ll = "x86_64" ]; then
 tar zxvf jre-8u111-linux-x64.tar.gz -C $JAVA_PATH
elif [ $ll = "i686" ]; then
 "no support x32 system"
else
 echo "unkown platform"
fi

#copy so 
if [ ! -f "/lib/libsigar-amd64-linux.so" ] ; then 
  cp libsigar-amd64-linux.so /lib
fi

if [ ! -f "/lib/libsigar-ia64-linux.so" ] ; then
  cp libsigar-ia64-linux.so /lib
fi

cd $JAVA_HOME
chmod 755 $JAVA_HOME/bin/java

echo "export JAVA_HOME=$JAVA_HOME">>/etc/profile
echo "export PATH=$JAVA_HOME/bin:\$PATH">>/etc/profile
echo "export CLASSPATH=$JAVA_HOME/lib:\$CLASSPATH">>/etc/profile
source /etc/profile
exit 0

[root@admin etc]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.

If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'
mysql          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
netconsole     	0:off	1:off	2:off	3:off	4:off	5:off	6:off
network        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
nginx          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
tomcat7        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
tomcat8        	0:off	1:off	2:on	3:on	4:on	5:on	6:off

linux添加开机自启动脚本示例详解
[http://blog.csdn.net/hshl1214/article/details/47109041]
[https://www.cnblogs.com/panjun-Donet/archive/2010/08/10/1796873.html]
1) systemd -> systemctl [守护进程]
2) etc/init.d [目录]
3) chkconfig  [命令]

chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息
谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接
运行级文件:
每个被chkconfig管理的服务需要在对应的init.d下的脚本加上两行或者更多行的注释。
第一行告诉chkconfig缺省启动的运行级以及启动和停止的优先级。如果某服务缺省不
在任何运行级启动,那么使用 - 代替运行级。第二行对服务进行描述,可以用\ 跨行注释。
例如,random.init包含三行:
# chkconfig: 2345 20 80
# description: Saves and restores system entropy pool for \
# higher quality random number generation.

使用范例:
chkconfig --list        #列出所有的系统服务
chkconfig --add httpd   #增加httpd服务
chkconfig --del httpd   #删除httpd服务
chkconfig --level httpd 2345 on  #设置httpd在运行级别为2、3、4、5的情况下都是on(开启)的状态
chkconfig --list        #列出系统所有的服务启动情况
chkconfig --list mysqld #列出mysqld服务设置情况
chkconfig --level 35 mysqld on   #设定mysqld在等级3和5为开机运行服务
chkconfig mysqld on    #设定mysqld在各等级为on,“各等级”包括2、3、4、5等级

如何增加一个服务:
1.服务脚本必须存放在/etc/ini.d/目录下;
2.chkconfig --add servicename
在chkconfig工具服务列表中增加此服务,此时服务会被在/etc/rc.d/rcN.d中赋予K/S入口了;
3.chkconfig --level 35 mysqld on
修改服务的默认启动等级。

最后补充下,shell 编程 case 语句的用法:

[http://blog.csdn.net/dreamtdp/article/details/8048720]
case语句适用于需要进行多重分支的应用情况。
        case分支语句的格式如下:
            case $变量名 in
                模式1)
            命令序列1
            ;;
                模式2)
            命令序列2
         ;; 
                *)
            默认执行的命令序列     ;; 
            esac 
case语句结构特点如下:
1)case行尾必须为单词“in”,每一个模式必须以右括号“)”结束。
2)双分号“;;”表示命令序列结束。
3)匹配模式中可是使用方括号表示一个连续的范围,如[0-9];使用竖杠符号“|”表示或。
4)最后的“*)”表示默认模式,当使用前面的各种模式均无法匹配该变量时,将执行“*)”后的命令序列。
5) 以esac 结尾,dos 与 liunx 特殊语法,内裤反穿法 [if -> fi] [case -> esac]

#!/bin/bash

i=1
while(($i<100)) #双括号形式,内部结构有点像C的语法,注意赋值:i=$(($i+1))
do
	if(($i%4==0)); then
		read -p "press some key ,then press return :" KEY   #read 为关键字
		case $KEY in
		 [a-z]|[A-Z])
			echo "It's a letter."
			;;
		 [0-9]) 
			echo "It's a digit."
			;;
			*)
			echo "It's function keys、Spacebar or other ksys."
		esac
	fi 
		i=$(($i+1));
done


#!/bin/sh 
 
case $1 in 
    start | begin) 
        echo "start something" 
        ;; 
    stop | end) 
        echo "stop something" 
        ;; 
    *) 
        echo "Ignorant" 
        ;; 
 esac 
 
# break 命令不执行当前循环体内break下面的语句从当前循环退出. 
# continue 命令是程序在本循体内忽略下面的语句,从循环头开始执行 
min=1
max=100
while [ $min -le $max ]
do
    echo $min
    min=`expr $min + 1`
done  


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值