Stopping a shell script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Stopping a shell script
# 8  
Old 12-27-2007
You can't do this:
if [ $End_Date != '-' -a $End_Date > $Start_Date ]; then

OK, you can do that, but you are redirecting the output of the [ command into a file named for your start date with "> $Start_Date" and your test is:
if [ $End_Date != '-' -a $End_Date ]; then

This collapses to testing if $End_Date is null or not.

All of this is legal, but possibly not what you intended.
# 9  
Old 12-27-2007
You make a good point.

What I want to do is make sure that the End_date is larger than the Start_Date. What is the operand for that?
# 10  
Old 12-27-2007
-gt

You can do "man test" to all of the options.
# 11  
Old 01-01-2008
Quote:
Originally Posted by Perderabo
-gt

You can do "man test" to all of the options.
The -gt option looks for intigers, but I have a date.

How do I get test to evaluate dates?
# 12  
Old 01-01-2008
The test(1) utility cannot handle dates. I suggest you convert your dates to the Julian format i.e. integers and then use test to compare these integers

Here is a pointer to an SysAdmin article on the subject:

Sys Admin > v12, i07: Date Arithmetic with the Shell
# 13  
Old 01-01-2008
-gt can handle large integers. If the date is YYYYMMDD format, it should work.
# 14  
Old 01-01-2008
Quote:
Originally Posted by Perderabo
-gt can handle large integers. If the date is YYYYMMDD format, it should work.
I need time as well...will this still be true if I do:

YYYYMMDDHHMMSS
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Stopping Windows 10 Clients?

As I know you are all aware Windows 10 poses some serious security concerns. My question is three fold. 1. Is there a way to stop Windows 10 clients from accessing a web server? 2. What would be the MS counter punch to that? ie: how would they circumvent. (mask browser credentials?) 3. Is... (4 Replies)
Discussion started by: ScottyPC
4 Replies

2. Shell Programming and Scripting

Stopping cron job

Hi, I have scheduled one job in crontab. I want to stop the job automatically after some time of its execution without killing it. Could i archive the above? (8 Replies)
Discussion started by: mehulleo
8 Replies

3. Red Hat

stopping you have mail.....

Hi, on server Red Hat Enterprise Linux AS release 3, I am getting the mail "you have mail" can any body suggest how to stop this? mail are getting generated in below path. /var/spool/postfix/maildrop, due to which heavy file are getting generated. though sendmail service is stopped. ... (0 Replies)
Discussion started by: manoj.solaris
0 Replies

4. UNIX Desktop Questions & Answers

stopping running process

hi all, I am using red hat AS 4 linux enterprise,i need to run my application such that while its running no other process shuld run all the remaining process should be suspended ,i need to use whole of the process only for that application to run ,can anyone suggest me how to do this. ... (3 Replies)
Discussion started by: srilakshmi
3 Replies

5. Shell Programming and Scripting

Stopping A process

Hi I want to stop a process using a shell script. how do i do that? ie, to simulate ps -ef|grep Process name get the process id and kill -9 process id plz help... (4 Replies)
Discussion started by: gopsman
4 Replies

6. Shell Programming and Scripting

Stopping a command in between

Hi Is it possible to stop a command executing after certain time? I have this command say prstat which keeps on giving the values etc of the processes after every 1 sec(refreshes the screen) What I want is just stop the execution after first screen Since I have written this command in shell... (3 Replies)
Discussion started by: superprg
3 Replies

7. UNIX for Advanced & Expert Users

stopping a processor

hi, Can any plz tell what is the command for stopping a processor? suppose a system is accessing 10 processors and we want to stop the 3rd & 6th processor then whats the command in Unix? thank u (2 Replies)
Discussion started by: nm_virtual
2 Replies

8. Shell Programming and Scripting

stopping a script

i want to stop a script from running after one minute, using the sleep command, and then kill the process. anyhelp with this. (2 Replies)
Discussion started by: AtomJ22
2 Replies

9. UNIX for Advanced & Expert Users

Stopping a print request

Im running a solaris 9 system and keep getting this message: Request to LXKF894CB (unknown printer) from zion. This happen because there was a mis configured printer and a job was submitted to it. I fix the printer issue but this message keeps repeating and the PID keeps going up. How can i... (5 Replies)
Discussion started by: meyersp
5 Replies
Login or Register to Ask a Question