shell 基本语法测试
来源:互联网 发布:天津seo网络优化公司 编辑:程序博客网 时间:2024/04/28 20:53
#! /bin/bash
if_find_file(){
if [ -e /home/allen/test/shell_test/echo.sh ]
then
echo "file exit......"
else
echo " can't find this file......"
fi
}
if_find_eth0(){
#ifconfig | grep ppp0
ifconfig | grep eth0 >> /dev/null
if [ "$?" == "0" ]
then
echo "find etho......"
else
echo "Don't find eth0......"
fi
}
while_print_hello(){
count=0
while [ $count -le 2 ]
do
echo "hello......"
#((count++))
let "count+=1"
sleep 0.01
done
}
for_print_num(){
for x in one two three
do
echo $x
sleep 1
done
for num in $(seq 1 3)
do
echo $num
sleep 0.000000001
done
}
main(){
# [ ! -e /home/allen/test/shell_test/echo.sh ] && { echo have file
#}
[ -e /home/allen/test/shell_test/echo.sh ] && { echo have file;}
# if_find_file
# if_find_eth0
# while_print_hello
# for_print_num
}
main
if_find_file(){
if [ -e /home/allen/test/shell_test/echo.sh ]
then
echo "file exit......"
else
echo " can't find this file......"
fi
}
if_find_eth0(){
#ifconfig | grep ppp0
ifconfig | grep eth0 >> /dev/null
if [ "$?" == "0" ]
then
echo "find etho......"
else
echo "Don't find eth0......"
fi
}
while_print_hello(){
count=0
while [ $count -le 2 ]
do
echo "hello......"
#((count++))
let "count+=1"
sleep 0.01
done
}
for_print_num(){
for x in one two three
do
echo $x
sleep 1
done
for num in $(seq 1 3)
do
echo $num
sleep 0.000000001
done
}
main(){
# [ ! -e /home/allen/test/shell_test/echo.sh ] && { echo have file
#}
[ -e /home/allen/test/shell_test/echo.sh ] && { echo have file;}
# if_find_file
# if_find_eth0
# while_print_hello
# for_print_num
}
main
0 0
- shell 基本语法测试
- Shell 基本语法
- Shell基本语法
- shell基本语法
- Shell 基本语法
- Shell的基本语法
- SHELL基本语法
- SHELL基本语法
- shell 基本语法总结
- Shell基本语法
- shell 基本语法
- Shell 基本语法
- shell基本语法
- shell基本语法二
- shell基本语法
- shell 脚本基本语法
- Shell 基本语法
- Shell 基本语法
- 微信支付有汉字时出现签名错误的解决办法
- intellij idea14 +svn配置
- 1. Event List
- 文字向左无缝滚动
- 使用httpclient构造http/https客户端
- shell 基本语法测试
- cherrypy简介
- 调用完系统相机,状态栏消失
- POJ3254Corn Fields
- AFNetworking 文件上传Data,File图片,文件等上传
- HDOJ 5137 How Many Maos Does the Guanxi Worth
- ATCA标准与测试
- POJ 3071 Football(概率dp)
- Github项目解析(十一)-->一个简单,强大的自定义广告活动弹窗