首先, Shell賦值時,等號左右兩邊是不能有空格的
一般賦值
s=123 echo $s
日期賦值
s=`date +"%Y-%m-%d"` # 注意`不是單引號, 而是~下面的點 echo %s`
對字符串進行連接
str1=abcstr3=${str1}.gz echo $str3
Shell 命令中的日期的相關(guān)參數(shù)
%%a literal %%alocale's abbreviated weekday name (e.g., Sun)%Alocale's full weekday name (e.g., Sunday)%blocale's abbreviated month name (e.g., Jan)%Blocale's full month name (e.g., January)%clocale's date and time (e.g., Thu Mar 3 23:05:25 2005)%Ccentury; like %Y, except omit last two digits (e.g., 21)%dday of month (e.g, 01)%D