[root@centos01 opt]# awk 'BEGIN {arr[0]=1; arr[1]=3; arr[2]=2; n=asort(arr);for(i=1;i<=n;i++) print(arr[i])}'
1
2
3
awk 'BEGIN{arr[0]=1;arr[1]=4;arr[2]=2;n=asort(arr);for(i=1;i<=n;i++)print(arr[i])}'
#!/bin/bash
city1="北京"
city2='上海'
city3=南京
echo $city1
echo $city2
echo $city3
hobby="java"
skill="i am good at $hobby"
echo $hobby
echo $skill
//打印字符串的长度
echo ${#skill}
str="I AM LIUYUANYANG"
#16
echo ${#str}
echo $str
#AM LIUYUANYANG
echo ${str:2}
//AM
echo ${str:2:2}
//str中a的位置
echo `expr index "$str" a`
:<<EOF
注释内容区域
EOF
:<<!
注释内容区域
!
#!/bin/bash
!<<!
echo "hello"
echo "hello"
!
echo "hello"
#!/bin/bash EOF
<<!
echo "hello"
echo "hello"
EOF
echo "hello"
#!/bin/bash
arr=(1 2 3 4 5)
echo ${arr[0]}
echo ${arr[1]}
echo ${arr[2]}
echo ${arr[3]}
echo ${arr[4]}
arr[0]="张三"
arr[1]="李四"
arr[2]="王五"
echo ${arr[0]}
echo ${arr[1]}
echo ${arr[2]}
#!/bin/bash
a=10
b=20
echo `expr $a + $b`
打印的是30
#!/bin/bash
a=10
b=20
echo `expr $a+$b`
打印的是10+20
#!/bin/bash
a=10
b=20
echo expr $a + $b
打印的是expr 10 + 20
JDBC:https://pan.baidu.com/s/1D6htw0S5FpDTXjkab8dlDQ?pwd=qwx0
提取码:qwx0
2天Mybatis:https://pan.baidu.com/s/1K5BqlQwLPpum3NuuY89ccQ?pwd=6nrd
提取码:6nrd
MyBatisPlus:https://pan.baidu.com/s/13Nm4-XW_TA5Gy-9WIsZLZQ?pwd=ouln
提取码:ouln
SpringMVC:https://pan.baidu.com/s/1Qemx79X7NTRbSqXBfJicnQ?pwd=l3ub
提取码:l3ub
Spring:https://pan.baidu.com/s/1GTlQFCiE0s1_oOUhDQi3ww?pwd=cs4q
提取码:cs4q
Linux:https://pan.baidu.com/s/1-ppyD9guaVteyK0S9HKtuA?pwd=hsa0
提取码:hsa0
[root@centos01 home]# cat test01.sh
#!/bin/bash
a=9
if [ $a -gt 10 ];then
echo "a大于10"
else
echo "a小于等于10"
fi
#!/bin/bash
a=7
b=8
if [ $a -gt $b ];then
echo "a大于b"
elif [ $a -eq $b ];then
echo "a等于b"
else
echo "a小于等于b"
fi
--------------------------------------------------------------
#!/bin/bash
a=6
b=30
:<<!
if [ $a -gt $b ];then
echo "a大于b"
elif [ $a -eq $b ];then
echo "a等于b"
else
echo "a小于等于b"
fi
!
if test $[ a + b ] -gt $[ a * a ];then
echo "a+b大于a*a"
elif test $[ a + b ] -lt $[ a * a ];then
echo "a+b小于a*a"
else
echo "a+b等于a*a"
fi
#!/bin/bash
for str in i like java;do
echo $str
done
echo "==============="
for i in 1 2 3 4 5;do
echo $i
done
echo "==============="
for i in {1..10};do
echo $i
done
echo "=====输出1到10之间的奇数========"
for i in {1..10..2};do
echo $i
done
echo "=====while循环========"
#!/bin/bash
i=1
while [ $i -le 10 ];do
echo $i
((i++))
done
echo "----输出1-10 的和-------"
sum=0
a=1
while [ $a -le 10 ];do
sum=$[ sum + a ]
a=$[ a + 1 ]
done
echo $sum
echo "----case用法-------"
#!/bin/bash
echo "请输入1-4之间的数字"
read num
case $num in
1) echo "你输入了1"
;;
2) echo "你输入了2"
;;
3) echo "你输入了3"
;;
4) echo "你输入了4"
;;
*) echo "你输入的信息不符合要求"
;;
esac