Static variable in shell


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Static variable in shell
# 1  
Old 05-29-2009
Static variable in shell

Hi All,

I want a static variable in shell script.

I have a script in which I want to send mail on certain condition and it happens that when that condition is met it start mailing as i have set my cron job to execute every 15 mins.

And what i want is to run that script after every 15 mins and send mail only for 10 time and then stop for the day.

What i plan to do is I will have a variable (static) that will keep track of this count that how many times mail has been sent already and then stop and start again next day for which i think i will use date or time as a parameter.

Please suggest me or propose a better solution.
I am not interested in autosys job although.

Thankyou
Yagami
# 2  
Old 05-29-2009
Double post (rule violation). Continue here:

https://www.unix.com/shell-programmin...-new-post.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[SHELL: /bin/sh] For loop using variable variable names

Simple enough problem I think, I just can't seem to get it right. The below doesn't work as intended, it's just a function defined in a much larger script: CheckValues() { for field in \ Group_ID \ Group_Title \ Rule_ID \ Rule_Severity \ ... (2 Replies)
Discussion started by: Vryali
2 Replies

2. Programming

Even the Static cURL Library Isn't Static

I'm writing a program which uses curl to be run on Linux PCs which will be used by a number of different users. I cannot make the users all install curl on their individual machines, so I have tried to link curl in statically, rather than using libcurl.so. I downloaded the source and created a... (8 Replies)
Discussion started by: BrandonShw
8 Replies

3. Programming

C++ program is crashing on re-assigning const static member variable using an int pointer

Hi, Can any one tell me why my following program is crashing? #include <iostream> using namespace std; class CA { public: const static int i; }; const int CA::i = 10; int main() { int* pi = const_cast<int*>(&CA::i); *pi = 9; cout << CA::i << endl; } (6 Replies)
Discussion started by: royalibrahim
6 Replies

4. Shell Programming and Scripting

Not able to store command inside a shell variable, and run the variable

Hi, I am trying to do the following thing var='date' $var Above command substitutes date for and in turn runs the date command and i am getting the todays date value. I am trying to do the same thing as following, but facing some problems, unique_host_pro="sed -e ' /#/d'... (3 Replies)
Discussion started by: gvinayagam
3 Replies

5. Emergency UNIX and Linux Support

Merge Static and dynamic parts in variable declaration

Dear Unix experts Moved from "Shell Programming and Scripting " I want to define a variable which contains dynmic and static part, daynamic part is the first field. Sample of data dddd aaaa sssss 12345 ssss 2323 234234 4242 dddd 3223 34234 54353 ssss 24234 3434 42342 dddd rwrw 423423... (2 Replies)
Discussion started by: yahyaaa
2 Replies

6. Shell Programming and Scripting

Merge Static and dynamic parts in variable declaration

Dear Unix experts I want to define a variable which contains dynmic and static part, daynamic part is the first field. Sample of data dddd aaaa sssss 12345 ssss 2323 234234 4242 dddd 3223 34234 54353 ssss 24234 3434 42342 dddd rwrw 423423 werwer nawk 'BEGIN {FS=" "}{... (4 Replies)
Discussion started by: yahyaaa
4 Replies

7. IP Networking

I need HELP to Set up Coyote Linux router with 1 static IP & 64 internal static IP

hello, i need help on setting my coyote linux, i've working on this for last 5 days, can't get it to work. I've been posting this message to coyote forum, and other linux forum, but haven't get any answer yet. Hope someone here can help me...... please see my attached picture first. ... (0 Replies)
Discussion started by: dlwoaud
0 Replies

8. Shell Programming and Scripting

Static variable in shell

Hi All, I want a static variable in shell script. I have a script in which I want to send mail on certain condition and it happens that when that condition is met it start mailing as i have set my cron job to execute every 15 mins. And what i want is to run that script after every 15... (4 Replies)
Discussion started by: Yagami
4 Replies

9. Programming

static variable storage

Hi, Where are the static variables actually stored in memory. Is it in .bss? In that case how is its storage different from global variables? From the ELF data is it possible to see the storage of different variables used in the program? eg: static int temp1; int gtemp1; main() {... (1 Reply)
Discussion started by: naan
1 Replies

10. Shell Programming and Scripting

Fake Static IP... (shell script)

I'm working on a script that runs on remote hosts and sends their dynamic IP address' to a server (which of course has statics). All the client computers run linux (as does the server). basically... the idea was: 1) Host a webpage on the server with a php script that displays only the IP... (2 Replies)
Discussion started by: heith
2 Replies
Login or Register to Ask a Question