แค่เว็บๆหนึ่ง ! ที่อยากเก็บประสบการณ์
Home
 

การบวกเลขใน Shell Script

-i   กำหนดตัวแปรป็น  integer  
#!/bin/bash
# set x,y and z to an integer data type
declare -i x=10
declare -i y=10
declare -i z=0
z=$(( x + y ))
echo "$x + $y = $z"
Off 

August 16, 2014 This post was written by Categories: เรื่องเล่ารายวัน No comments yet


Top