系統 - Debian - Shell Script($、{}、%、#)



run.sh

#!/bin/sh
t="123456789"

echo $t
echo ${t}
echo ${t%789}
echo ${t#123}

測試

$ ./run.sh 
    123456789
    123456789
    123456
    456789

$:參數
{}:參數展開
%:去除尾端字串
#:去除開頭字串