shell判断数字
来源:互联网 发布:java语言入门书 编辑:程序博客网 时间:2024/05/16 10:24
用shell来判断输入的是否是数字。
#cat isnum.sh
#!/bin/sh
file_size=128
echo "Please input a number for testing:"
read n
input_num="$(echo "$n" | sed -n "/^[0-9]\+$/p")"
if [ -n "$input_num" ];then
echo "Input is a number!"
file_size="$input_num"
echo "The number is: $file_size."
else
echo "Input isn't a number!"
echo "Use defaule number $file_size."
fi
#cat isnum.sh
#!/bin/sh
file_size=128
echo "Please input a number for testing:"
read n
input_num="$(echo "$n" | sed -n "/^[0-9]\+$/p")"
if [ -n "$input_num" ];then
echo "Input is a number!"
file_size="$input_num"
echo "The number is: $file_size."
else
echo "Input isn't a number!"
echo "Use defaule number $file_size."
fi
- shell判断数字
- shell数字判断
- shell 脚本中数字判断
- shell字符串比较、判断是否为数字
- shell字符串比较判断是否为数字
- shell字符串比较、判断是否为数字
- shell判断输入的参数是不是数字
- Shell字符串比较、判断是否为数字
- shell判断参数是否为数字
- shell 判断字符串是否为数字
- shell判断全部都是数字(shell学习笔记六)
- Linux系统shell脚本对字符串、数字、文件的判断
- 用shell判断一个字符串是不是全为数字
- shell中简易判断字符串是否为数字
- shell脚本--if判断(数字条件、字符串条件)
- shell 中一个变量是否为数字的判断
- 【shell学习】常用条件判断-字符,数字,文件
- shell脚本--if判断(数字条件、字符串条件)
- 先要到网上下载Snoopy.class.php
- struts-plugin resulttype 参数
- AP Confusion: Problems with ‘partitiontolerance
- mysql5.5.22 源码编译
- android/NDK开发assets资源中文名打包问题
- shell判断数字
- java.lang包 详解
- HTTP响应状态码详解
- Xcode各个版本下载地址
- SQL存储过程返回格式化过的字符串
- samba configure
- JS ARRAY 数组操作
- 论商业化并非能振兴国产ACG
- NSString字符编码