![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how do i put a time stamp in a file name | jhamm | Shell Programming and Scripting | 5 | 01-29-2007 10:00 AM |
| Date/Time Stamp | JimmyFlip | UNIX for Dummies Questions & Answers | 0 | 11-14-2006 11:49 PM |
| greping with time stamp | arunkumar_mca | Shell Programming and Scripting | 1 | 07-28-2006 04:20 AM |
| capturing the time stamp | pavan_test | UNIX for Dummies Questions & Answers | 4 | 07-18-2006 01:35 PM |
| Date Time Stamp | jarich | Shell Programming and Scripting | 2 | 07-28-2005 09:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi,
I am having a script in which I am again calling a script, but before calling that script I need to perform a time check (say 1 - 2 am i.e. I would be able to call that script if time is between 1:00 am and 2:00 am) but this time stamp needs to be configurable. can anybody suggest me how I can achive this.. Thanks in advance Manvar |
|
||||
|
Quote:
You can do something like this-- #!/bin/ksh echo "To run a script in between a given time" str1=`date | cut -d" " -f4` str2=`echo $str1 | cut -d":" -f1` if [[ $str2 -eq 13 ]] or if [[ $(date +%h) -eq 13 ]] then ksh test2 else echo "Wrong" fi Thanks Namish Last edited by namishtiwari; 08-22-2007 at 04:19 AM.. |
|
||||
|
thanks Namish for your reply,
but this is not the solution I want, as per your solution if [[ $str2 -eq 13 ]] now in future if I want to change 13 to 15 then I have make changes in the code. and I dont want to cahnge in the code. I want my script capable of taking this time from some where outside this script. I hope you got my problem. Regards Manvar |
|
||||
|
Manvar,
You can read the time like this echo "Enter the start time stamp" read stime echo "Enter the end time" read etime and do your manipulations on these variables itself. is that going to help you. Thanks Namish |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|