#!/bin/bash a=10 b=20 c=`expr $a + $b` echo "a + b :$c" c='expr $a + $b' echo "a + b :$c" c="expr $a + $b" echo "a + b :$c" c=$(($a+1)) echo "a + b :$c" c=$[ $a + 1 ] echo "a + b :$c" 输出结果: book@…
名称:expr ### 字串长度 shell>> expr length "this is a test" 14 ### 数字商数 shell>> expr 14 % 9 5 ### 从位置处抓取字串 shell>> expr substr "this is a test" 3 5 is is ### 数字串 only the first character shell>> expr index…
1.1.变量替换 变量替换的六种形式 实例:非贪婪和贪婪的区别 从头部删除 [root@VM_0_9_centos shell_learn]# var_1="i love you,do you love me" [root@VM_0_9_centos shell_learn]# echo $var_1 i love you,do you love me [root@VM_0_9_centos shell_learn]# var1=${var_1#*ov} [root@VM_0_9_ce…