我在配置文件中有 4 个名称(AA、BB、CC、DD)。这已在脚本中使用。
我正在尝试将输出另存为
Source_Server_Path="/dev/FtpData_Files/START_STOP_"$1"_"$Current_Date""
$1
名字中的任何一个都在哪里。
$Current_Date
格式必须为 05Jun2013。
$ foo="/bar/quux/$(date +%d%b%Y)"
$ echo "${foo}"
/bar/quux/07Jun2013
另请参阅man date
。
示例脚本/方法...尝试是否有帮助
配置文件
AA,BB,CC,DD
脚本.sh
file=$1
config=`cat $file | awk -F "," '{print $1}'`
#It will take AA .. whatever parameter you pass
Current_Date=`date +%d%b%Y`
echo START_STOP_"$config"_"$Current_Date"
如何运行
sh script.sh config.txt
输出
START_STOP_AA_07Jun2013