Variable initialization


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Variable initialization
# 8  
Old 06-23-2014
Hallo Corona,

Code:
[mind@util1-pkl REPORTS]$ date.pl +"%d %B %Y"
-bash: date.pl: command not found
[mind@util1-pkl REPORTS]$ date -d "2014/06/23 - 1 month"
Fri May 23 00:00:00 SAST 2014
[mind@util1-pkl REPORTS]$

There are 2 Options on my script which i can use:

Option A:

Code:
../getUsageDetailsFromMind_Where.pl "where accountid in (select id from accounts where parent = 77) and calldate between '20 MAY 2014' and '19 JUN 2014' and destination  in (select  distinct accountani from asani where (accountani between '0124264000' and '0124264611'))" MHG_Bitts_Only_Billing_201406 Y Y N;

../getUsageDetailsFromMind_Where.pl "where accountid in (select id from accounts where parent = 77) and calldate between '20 MAY 2014' and '19 JUN 2014' and destination  in (select  distinct accountani from asani where (accountani between '0116712000' and '0116712999'))" MHG_MedScheme_Only_Billing_201406_1 Y Y N;

Or Option B:

Code:
../getUsageDetailsFromMind_Where.pl "where accountid in (select id from accounts where parent = 77) and calldate  >= to_date('20052014', 'ddmmyyyy')  AND calldate <= to_date('19062014', 'ddmmyyyy')and destination  in (select  distinct accountani from asani where (accountani between '0124264000' and '0124264611'))" MHG_Bitts_Only_Billing_201406 Y Y N;

../getUsageDetailsFromMind_Where.pl "where accountid in (select id from accounts where parent = 77) and calldate  >= to_date('20052014', 'ddmmyyyy')  AND calldate <= to_date('19062014', 'ddmmyyyy') and destination  in (select  distinct accountani from asani where (accountani between '0116712000' and '0116712999'))" MHG_MedScheme_Only_Billing_201406_1 Y Y N;

This script has to be run every month on the 20th.

On Option A:
Code:
variableA='20 MAY 2014'
variableB='19 JUN 2014'

Or Option B:
Code:
VariableA='20052014'
VariableB='19062014'


Last edited by Don Cragun; 06-24-2014 at 05:00 AM.. Reason: Fix closing CODE tag.
# 9  
Old 06-23-2014
First off, you don't need my date.pl because you have GNU date. It says in the thread that it's a minimal GNU date imitation, if you have GNU date you don't need it.

Second off, you clearly can't run date.pl if you didn't make the file.

Third off, you clearly can't run it just by typing in 'date.pl', but by typing in './date.pl' as my posts clearly illustrate.

Fourth off... You don't need my date.pl because you have GNU date.

Lastly: You haven't tried any of my or anyone else's suggestions at all, preferring to wait for a whole answer. I refuse to accept that you're that helpless, but:
Code:
DAY=$(date +%Y-%m-%d)
CURDAY=$(date -d "$DAY" +"%d %B %Y")
PREV=$(date -d "$DAY - 1 month" +"%d %B %Y")

# 10  
Old 06-24-2014
Thank you everyone.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error occurred during initialization of VM

Hi , I was invoking a sh file using the nohup command. But while invoking, I received a below error. Error occurred during initialization of VM Unable to load native library: /u01/libjava.so: cannot open shared object file: No such file or directory . Could you please help out. Regards,... (2 Replies)
Discussion started by: Kamal1108
2 Replies

2. Programming

C- static initialization of structures

Situation: I have an array of structures: struct my_struct_type { char tags_sn; char group_c; char is_err_c; }; struct my_struct_type stuff = { "abcd", 'A', 'E', "efgh", 'B', 'E', "ijkl", 'C', 'E' NULL, '\0', '\0' ... (14 Replies)
Discussion started by: garysk
14 Replies

3. UNIX for Advanced & Expert Users

openmpi - initialization failed

Hi everybody, my problem is the following: I'm trying to run an openmpi program on a cluster (atlasz.elte.hu, it's in hungarian, but you can try google translate), but I always got this error: Fatal error in MPI_Init: Other MPI error, error stack: MPIR_Init_thread(394)...........:... (0 Replies)
Discussion started by: jkobori
0 Replies

4. Shell Programming and Scripting

Initialization error

new to shell scripting. below line is showing error in script. ${parameter:=word} in the o/p first it shows the below error. word: not found. and then in next line print "word" ---------------- p2: word: not found. word --------------------------- OS is AIX and shell is... (12 Replies)
Discussion started by: scriptor
12 Replies

5. Programming

Class Pointer initialization C++

Hello everyone, I have a question, that are the following ways of pointer intialization same ? ClassA *point; point = 0; point = new ClassA; Thanks a load in advance!! Regards, (10 Replies)
Discussion started by: mind@work
10 Replies

6. Shell Programming and Scripting

little confusion about variable initialization.

Whenever i execute the below scriptlet with out proper file name it deletes /tmp directory . I guess this is because value of variable a didnt get initialized and there for rm -rf /tmp/ get executed and entire /tmp directory get deleted. How would i avoid any empty variables to be used in... (9 Replies)
Discussion started by: pinga123
9 Replies

7. Programming

Char initialization

Hi All, char a="\0"; a) a contains \0 a contains garbage value b) a contains \ a contains 0 a contains garbage value Pls, let me know correct result is a or b. I guess a. Thanks, Naga:cool: (2 Replies)
Discussion started by: Nagapandi
2 Replies

8. UNIX for Dummies Questions & Answers

Shell initialization files

As you know, when a user logs in, the shell reads the initialization files in an order something like below... ################### Bourne Shell /etc/profile > $HOME/.profile Bash Shell /etc/profile > $HOME/.bash_profile > $HOME/.bash_login > $HOME/.profile > $HOME/.bashrc C Shell... (3 Replies)
Discussion started by: SeanWuzHere
3 Replies

9. UNIX for Dummies Questions & Answers

Help regarding storing the initialization parameters

Hi all, In my shell script, I am reading some files, processing them, and writing the out-put in the log files. The out put contains number of rows in the file etc. I want to fetch the input files from a particular directory and I want to write the logs in a particular directory with a particular... (1 Reply)
Discussion started by: VENC22
1 Replies

10. Programming

Struct Initialization

Hi We are using a code generator for initializing structures with the #define macro. Compiling it with the GCC 2.8.1 (with -ansi) it OK. But when we are using the SUN C 5.0 compiler it screams. Following is a code sample: #include <stdlib.h> #include <stdio.h> typedef struct TEST3 {... (4 Replies)
Discussion started by: amatsaka
4 Replies
Login or Register to Ask a Question