首先, Shell赋值时,等号左右两边是不能有空格的
一般赋值
s=123 echo $s
日期赋值
s=`date +"%Y-%m-%d"` # 注意`不是单引号, 而是~下面的点 echo %s`
对字符串进行连接
str1=abcstr3=${str1}.gz echo $str3
Shell 命令中的日期的相关参数
%%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
联系客服