You are using the script's parameters inconsistently, or you're describing the problem incompletely, or I'm getting it incorrectly.
Please take a step back and rephrase your problem. Do you always need 365 (366) iterations? Always 12 months? Always 12 months back? Where does $2 come into play? How does the start date relate to the parameters? Why does your loop iterate across months but supplies a constant parameter to invoke_script? Why do you use "command substitution" to evaluate months?
Date & time arithmetics is one of the worst problems in IT, so you can spend endless time and resources to get it right. Ignoring several itches like short months, year end crossing, and leap years, here is a veeery simple approach to get you started with the sample data that you gave. Error messages are sent to the null device, and we use the (dangerous and deprecated) eval command because we (hope we) know exactly what we're doing, and take advantage of recent bash's functionality. Try (with $1 set to 170101, and $2 to 12):
If happy, you can run this through e.g. sh.
I am having below script which needs to be executed based on start and end date
#!/bin/bash
array=('2016-09-27' '2016-10-27' '2016-11-27' '2016-12-27' '2017-01-27' '2017-02-27' '2017-03-27' '2017-04-27' '2017-05-27' '2017-06-27' '2017-07-27' '2017-08-27' '2017-09-27' )
for i in "${array}"
do... (9 Replies)
Hi
I have a text file (Input.txt) with two column entries separated by tab as given below:
aaa str1
bbb str2
cccccc str3
dddd str4
eee str3
ssss str2
sdf str3
hhh str1
fff str2
ccc str3
.....
.....
..... (1 Reply)
hi Guys,
is there a way to pass parameter into oracle store procedure by reading date range in file and increment accordingly. Something like this
file.txt
01-JAN-2015
03-JAN-2015
sqlplus -s user/pwd@DB
execute TEST( to_date( '01-JAN-2015, 'dd.mm.yyyy' ), to_date( '03-JAN-2015', ... (1 Reply)
Hi.
How do I achieve this
sh /EDWH-DMT02/script/MISC/exec_sql.sh "@/EDWH-DMT02/script/others/CSM_CKC/Complete_List.sql ${file_name}" Complete_List.txt
The /EDWH-DMT02/script/MISC/exec_sql.sh has two parameters and it's working fine with this
sh /EDWH-DMT02/script/MISC/exec_sql.sh... (7 Replies)
I need to check if the parameters are correctly passed based on the Environment I am in.
For e.g when I am in dev the 1st paramter needs to be either A OR B OR C OR D
similarly when I am in qa the parameter needs to be either e or f
so i need to write a case staement or a if statement to... (1 Reply)
I have written a stored procedure in oracle database, which is having a CLOB OUT parameter. How can i call this stored procedure from shell script and get the CLOB object in shell script variable? (0 Replies)
while i try to start the audit i have the below error message .
audit>audit start
** auditing enabled already
A system call received a parameter that is not valid.
please advice (6 Replies)
I need a script to get the files for DEC
the file format will be
B20_abc_ancdfefg_20101209_INCR_201012100145.TXT.gz
Based on the bold ones (date) i need to get the files
can any one help me plzzzzzz (2 Replies)
Hi all
Im calling a DB procedure as foll
sqlplus -s $DB_USERID/$DB_PASSWD@$DB_NAME<<eof
var var1 VARCHAR2(200);
exec ODAS_BATCH_JOBS_RETRIEVE.retrieve_user_info(:var1);
eof
echo $var1
This echo is giving a blank.
Also in case the package ODAS_BATCH_JOBS_RETRIEVE is in an un compiled... (2 Replies)
Hello friends,
I am looking for a script or method that can display all the dates between any 2 given dates.
Input:
Date 1
290109
Date 2
010209
Output:
300109
310109
Please help me. Thanks. :):confused: (2 Replies)