ex13.sh

来自「Shall高级编程」· Shell 代码 · 共 37 行

SH
37
字号
#!/bin/basha=4b=5#  Here "a" and "b" can be treated either as integers or strings.#  There is some blurring between the arithmetic and string comparisons,#+ since Bash variables are not strongly typed.#  Bash permits integer operations and comparisons on variables#+ whose value consists of all-integer characters.#  Caution advised, however.echoif [ "$a" -ne "$b" ]then  echo "$a is not equal to $b"  echo "(arithmetic comparison)"fiechoif [ "$a" != "$b" ]then  echo "$a is not equal to $b."  echo "(string comparison)"  #     "4"  != "5"  # ASCII 52 != ASCII 53fi# In this particular instance, both "-ne" and "!=" work.echoexit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?