1

我在配置文件中有 4 个名称(AA、BB、CC、DD)。这已在脚本中使用。

我正在尝试将输出另存为

Source_Server_Path="/dev/FtpData_Files/START_STOP_"$1"_"$Current_Date""

$1名字中的任何一个都在哪里。

$Current_Date格式必须为 05Jun2013。

4

2 回答 2

4
$ foo="/bar/quux/$(date +%d%b%Y)"
$ echo "${foo}"
/bar/quux/07Jun2013

另请参阅man date

于 2013-06-07T11:47:44.487 回答
2

示例脚本/方法...尝试是否有帮助

配置文件

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
于 2013-06-07T13:28:13.977 回答