免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1639 | 回复: 4
打印 上一主题 下一主题

typeset的小问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-08-12 15:53 |只看该作者 |倒序浏览
代码如下:
#! /usr/bin/ksh
typeset -i rslnum

其中rslnum是系统定义的常量么?
$ typeset |grep rslnum
输出如下:
integer base 0 rslnum

哪位大虾帮忙解释一下,谢谢

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
2 [报告]
发表于 2008-08-12 15:56 |只看该作者
  1.        typeset [-afFirtx] [-p] [name[=value] ...]
  2.               Declare variables and/or give them attributes.  If no names are
  3.               given then display the values of variables.  The -p option will
  4.               display the attributes and values of each  name.   When  -p  is
  5.               used,  additional  options are ignored.  The -F option inhibits
  6.               the display of function definitions; only the function name and
  7.               attributes  are  printed.   If  the  extdebug  shell  option is
  8.               enabled using shopt, the source file name and line number where
  9.               the  function  is defined are displayed as well.  The -F option
  10.               implies -f.  The following options can be used to restrict out-
  11.               put  to variables with the specified attribute or to give vari-
  12.               ables attributes:
  13.               -a     Each name is an array variable (see Arrays above).
  14.               -f     Use function names only.
  15.               -i     The variable is treated as an integer; arithmetic evalu-
  16.                      ation (see ARITHMETIC EVALUATION ) is performed when the
  17.                      variable is assigned a value.
复制代码

论坛徽章:
0
3 [报告]
发表于 2008-08-12 15:58 |只看该作者
rslnum是变量

论坛徽章:
0
4 [报告]
发表于 2009-02-04 18:51 |只看该作者
rslnum 被定义成整型变量.

论坛徽章:
0
5 [报告]
发表于 2009-02-04 19:16 |只看该作者
ksh中可以用typeset -i定义一个整形变量,定义的变量可以直接进行算术运算
如:
typeset -i n
n=5 + 5
echo $n
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP