I have 4 names (AA,BB,CC,DD) in a config file. This has been used in a script.
I am trying to get the output to be saved as
Source_Server_Path="/dev/FtpData_Files/START_STOP_"$1"_"$Current_Date""
where $1
will be any one in the names.
$Current_Date
has to be in the format 05Jun2013.
$ foo="/bar/quux/$(date +%d%b%Y)"
$ echo "${foo}"
/bar/quux/07Jun2013
See also man date
.
Sample script/method ... Try if it helps
config.txt
AA,BB,CC,DD
Script.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"
How to run
sh script.sh config.txt
Output
START_STOP_AA_07Jun2013
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.