shell中if使用方法

时间:2024-10-12 07:29:40

1、if的语法结构if 职邗珩垃[ condition ]then statements[elif condition then statements. ..][else statements ]fi

shell中if使用方法

2、整数比较

shell中if使用方法

3、字符串比较

shell中if使用方法

4、权限判断,用于判断文件对当前用于的权限-r 有读的权限-w 有写的权限-x 有执行的权限

5、if对于文件的判断

shell中if使用方法

6、脚本实例脚本一:#!/bin/shecho "挢旗扦渌;Please input a integer:"rea颊俄岿髭d integer1if [ "$integer1" -lt 30 ]then echo "The integer which you input is lower than 30."fi脚本二:if [ -f 023.txt ];then echo "file is exist"else touch 023.txtfi

© 2025 光影知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com