藍森林首頁 | 返回主頁 | 本站地圖 | 站內搜索 | 聯繫信箱 |
 您目前的位置:首頁 > 自由軟件 > 技術交流 > 應用編程


    

藍森林 http://www.lslnet.com 2006年6月26日 11:18


請教問題:條件中使用的參數。

if [ $1 -gt 0 -a $1 -lt 13 ]
我今天看了一段代碼,裡面的變量後面有 -gt -lt還有其他的
請問是什麼意思,還有就是在何處能找到相關的介紹資料。
謝謝~~~~

大概知道了:
可以是等於(eq)、大於(gt)、小於(lt)、不等於(neq)、小於等於(le)、大於等於(ge)、任何(any)。
應該就是這個了。

(2)整數操作符具有和字符操作符類似的功能.只是他們的操作是針對整數
  test表達式   |    含義
  ---------------------------------------------
  Int1 -eq int2|當int1等於int2時,返回True
  Int1 -ge int2|當int1大於/等於int2時,返回True
  Int1 -le int2|當int1小於/等於int2時,返回True
  Int1 -gt int2|當int1大於int2時,返回True
  Int1 -ne int2|當int1不等於int2時,返回True

這裡有詳細的信息。。
http://www.21ds.net/article/_32/base/2005-05/17/508_1.html

謝謝樓上的回答,學習中~~~



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : webmaster@lslnet.com