HI,
i created the below script to create the multiple files, iam not getting the required output, Please advice.
#!/bin/sh
v_date=$1 # argument will come as daymonthyear eg : 151112
v_day=`echo $v_date | cut -c 1-2`
v_mon=`echo $v_date | cut -c 3-4`
v_year=`echo $v_date | cut -c 5-6`
if [ $v_mon -eq 1 -o $v_mon -eq 3 -o $v_mon -eq 5 -o $v_mon -eq 7 -o $v_mon -eq 8 -o $v_mon -eq 10 -o $v_mon -eq 12 ];then
v_last_day=31
elif [ $v_mon -eq 4 -o $v_mon -eq 6 -o $v_mon -eq 9 -o $v_mon -eq 11 ];then
v_last_day=30
elif [ $v_mon -eq 2 ];then
v_last_day=28
fi
if [ $v_day -le 9 ];then
touch SkyOffer_Details_0{$v_day..9}$v_monv_year.txt
touch SkyOffer_Details_{10..$v_last_day}$v_mon$v_year.txt
else
touch SkyOffer_Details_{$v_day..$v_last_day}$v_mon$v_year.txt
fi
Hint : touch SkyOffer_Detail_{8..30}1112.txt this command creates the multiple files as below, but i want to do it as dynamically, so iam going for a script
SkyOffer_Details_81112.txt
SkyOffer_Details_91112.txt
SkyOffer_Details_101112.txt
SkyOffer_Details_111112.txt
..............
..............
...........
SkyOffer_Details_291112.txt
SkyOffer_Details_301112.txt
required output :
if argument is 081112, i want 0 byte files as
SkyOffer_Details_081112.txt
SkyOffer_Details_091112.txt
SkyOffer_Details_101112.txt
SkyOffer_Details_111112.txt
..............
..............
...........
SkyOffer_Details_291112.txt
SkyOffer_Details_301112.txt
script execution : when i executed the above script as
./script_name 081112
executed Output : scripts is creating the zero byte file as
SkyOffer_Detail_{8..30}1112.txt
but i want the output as
SkyOffer_Details_081112.txt
SkyOffer_Details_091112.txt
SkyOffer_Details_101112.txt
SkyOffer_Details_111112.txt
..............
..............
...........
SkyOffer_Details_291112.txt
SkyOffer_Details_301112.txt
COuld anyone help me to solve this.
Thank you.
Jagadeesh