How can i proceed on this (datecheck)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How can i proceed on this (datecheck)
# 1  
Old 06-24-2005
How can i proceed on this (datecheck)

Hi,


I want to bundle if statements

The script which i created is

if [[ $(date +'%H') -lt 12 ]]; then
if [[ $(date '+%a') = Sat ]]; then
now=`TZ=CST+24 date +%Y-%m-%d`
nows=`TZ=CST+24 date +%Y-%m-%d` ;
else [[ $(date '+%a') = Sun ]]; then
now=`TZ=CST+48 date +%Y-%m-%d`
nows=`TZ=CST+48 date +%Y-%m-%d` ;
fi
now=`TZ=CST+24 date +%Y-%m-%d`
nows=`date +%Y-%m-%e`
echo $now
echo $nows ;
fi

If the time is less than 12 then i want to assign yesterdays date to start_date and todays date to to_date.

If the day is saturday or sunday then I am assigning Friday dates to both start_date and end_date
When i tried this, i am getting error messges.
Can I use If statement like this ?
let me know.

Thanks in advance
cheers,
gops
# 2  
Old 06-24-2005
if [[ $(date +'%H') -lt 12 ]]; then
if [[ $(date '+%a') = Sat ]]; then
now=`TZ=CST+24 date +%Y-%m-%d`
nows=`TZ=CST+24 date +%Y-%m-%d` ;
else [[ $(date '+%a') = Sun ]]; then
now=`TZ=CST+48 date +%Y-%m-%d`
nows=`TZ=CST+48 date +%Y-%m-%d` ;
fi
now=`TZ=CST+24 date +%Y-%m-%d`
nows=`date +%Y-%m-%e`
echo $now
echo $nows ;
fi



then is not required first high lighted.

second hightlighted set of statements are exeucuted for every condition whether it is SAT or SUN ; Is this what you want ??
# 3  
Old 06-27-2005
Hi Bhargav,

Thanx for your prompt reply with code.

I want the second set of statement to be executed if it other than saturday or sunday. If it is saturday or sunday only statement bundled inside the inner if should be executed. Meantime I will try with your code and let me know the updates once you stepped in.

cheers,
gops
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to Proceed to the Next IP if the current IP hangs

Hi there, Say I have a list of IPs, I am running scripts on them. If the process hang. I want to continue with the rest of the IPs. 10.11.1.1 10.11.1.2 10.11.1.3 10.11.1.4 10.11.1.5 10.11.1.6 <-- Process Hangs here 10.11.1.7 10.11.1.8 10.11.1.9 10.11.1.10 10.11.1.11 10.11.1.12 ... (11 Replies)
Discussion started by: alvinoo
11 Replies

2. Shell Programming and Scripting

how to proceed when curl is finished

I have a script which uses cli curl to download the source code of a webpage and then tests if a specific string exists in the source. The problem is that the website has a slow response, so the eval expression hasn't completed when the test starts. The test returns a negative, and the curl... (8 Replies)
Discussion started by: locoroco
8 Replies

3. Shell Programming and Scripting

How to timeout and proceed in perl?

I'm writing a small socket program (UDP) to communicate between two servers. Problem is, I dont know how to implement time out hence my script keeps on waiting for the peer response. #!/usr/bin/bash use IO::Socket::INET; $|=1; $socket=new IO::Socket::INET->new(LocalPort=>5001, ... (2 Replies)
Discussion started by: Arun_Linux
2 Replies

4. Web Development

Request to check:PHP help hw to proceed

Hi I am new to PHP. I have to changed a website design adn add certain features and lnks which shuld direct it towards other website. Can any body help me how to proceed. I have some already made templates to do this. I am conpletely new.. So, I have to first install Php from... (0 Replies)
Discussion started by: manigrover
0 Replies

5. Solaris

Zlogin -C with out user Interaction how to proceed?

Hi Guys, I have one requirement like if we run install.sh file it should have to create a zone and install oracle in that zone with out any user interaction. So the complete code should be automated. Almost 90% of the code I completed but i am having some doubts 1) After the zone creation... (1 Reply)
Discussion started by: vijaysachin
1 Replies

6. Shell Programming and Scripting

Need suggestions about a datecheck script

I'm currently running a script that checks to see if a laptop is on the network, and if it is it backs up, if not it retries it later. Anyway, our backup scheduling has changed. I need to check if today's date is the Thursday after the first Wednesday of every month. This is made slightly more... (5 Replies)
Discussion started by: tsmurray
5 Replies

7. Shell Programming and Scripting

Need help for automating a task. How to proceed ?.

Dear friends, I am trying to prepare a shell script which do the following task. Being a beginner in scripting I need a bit of help from you all for shell script which does the following job. 1.Check for existence of a file in a shared directory (at some remote location ) once in a day ... (1 Reply)
Discussion started by: aarora_98
1 Replies

8. Programming

I am porting Dll from NT to Unix, how should I proceed

I am porting Dll from Windows NT to Unix, Could any body pls guide me how should I proceed?? (3 Replies)
Discussion started by: Vipin
3 Replies
Login or Register to Ask a Question