设为首页 加入收藏

TOP

Shell基础快速入门 了解shell运行原理(三)
2019-09-01 23:00:32 】 浏览:37
Tags:Shell 基础 快速 入门 了解 shell 运行 原理
e ] 返回 true。 -x file 检测文件是否可执行,如果是,则返回 true。 [ -x $file ] 返回 true。 -s file 检测文件是否为空(文件大小是否大于0),不为空返回 true。 [ -s $file ] 返回 true。 -e file 检测文件(包括目录)是否存在,如果是,则返回 true。 [ -e $file ] 返回 true。

file="/test.sh"
if [ -r $file ]

shell 流程控制

if condition
then
	command
fi
if condition
then
command
else
commandN
fi
if condition
then
command
elif confition2
then
command2
else
cpmmandN
fi
for loop in 1 2 3 4 5
do
echo $loop
done
while condition
do
command
done
until condition
do
command
done
与while正好相反
echo '输入 1 到 4 之间的数字:'
echo '你输入的数字为:'
read aNum
case $aNum in
    1)  echo '你选择了 1'
    ;;
    2)  echo '你选择了 2'
    ;;
    3)  echo '你选择了 3'
    ;;
    4)  echo '你选择了 4'
    ;;
    *)  echo '你没有输入 1 到 4 之间的数字'
    ;;
esac
首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇智能家居-2.基于esp8266的语音控.. 下一篇net namespace实验

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目