码迷,mamicode.com
首页 > 其他好文 > 详细

judge input type

时间:2018-01-11 11:46:53      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:lease   type   please   amp   input   echo   ash   read   expr   

#! /bin/bash
while true;do
read -p "please input:" a
expr $a + 1 &> /dev/null
if [ $? -eq 0 ] ;then
echo "input is int."
else
echo "input is char."
fi
if [ $a == ‘q‘ ];then
break
fi
done

judge input type

标签:lease   type   please   amp   input   echo   ash   read   expr   

原文地址:http://blog.51cto.com/546136/2059676

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!