1. 程式人生 > 其它 >shell程式設計例子(1),持續更新中

shell程式設計例子(1),持續更新中

技術標籤:linuxshell

1.hello word

#!/bin/bash
echo "hello word"

2. 變數

#!/bin/bash
#變數
my_name="Mr.zhang"
echo $my_name
echo ${my_name}

#只讀變數
sex="man"
age="20"
readonly sex
sex="woman"
age="21"

echo $sex
echo $age

執行結果:

3. 刪除變數

#!/bin/bash
#刪除變數

name="Mr.zhang"
score="30"

unset score

echo $name
echo $score

執行結果:

4.