The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Assign o/p of awk to a variable c2b2 Shell Programming and Scripting 8 04-01-2009 08:50 AM
assign value to variable using AWK HAA Shell Programming and Scripting 4 12-06-2006 11:43 AM
assign a value to variable markjason Shell Programming and Scripting 3 10-10-2006 03:05 PM
Assign time value phragix Shell Programming and Scripting 2 03-30-2005 10:06 AM
assign to variable AkumaTay UNIX for Dummies Questions & Answers 1 05-18-2002 03:11 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-05-2008
rosalinda rosalinda is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 15
how to assign the first day of the next month

Hi everybody,
I am very new in shell and this is my first post .
i am trying to write a script in which i want to decide some begin dates. this dates will be used by another shell scripts.
i would like to assign:
1- a variable which is a = sysdate
2- another variable b = the first day of the next month from sysdate

i want to have time in both, like sysdate is: 20080705 05:02:04,
and the first day of next month to be: 20080801 00:00:05

I appreciate a lot your kind help.
Regards.
  #2 (permalink)  
Old 07-05-2008
rosalinda rosalinda is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 15
Post How can i assign date to next month

Quote:
Originally Posted by rosalinda View Post
Hi everybody,
I am very new in shell and this is my first post .
i am trying to write a script in which i want to decide some begin dates. this dates will be used by another shell scripts.
i would like to assign:
1- a variable which is a = sysdate
2- another variable b = the first day of the next month from sysdate

i don't want the time to be exactly the same as sysdate, i would like to have time at midnight. is it possible to assign the time as i want also?

i want to have time in both, like sysdate is: 20080705 05:02:04,
and the first day of next month to be: 20080801 00:00:05

I appreciate a lot your kind help.
Regards.
....................................................
  #3 (permalink)  
Old 07-05-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,330
It's not allowed to bump up questions! Please read the rules.
  #4 (permalink)  
Old 07-05-2008
rosalinda rosalinda is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 15
hi,
how can i delete post? or the second part? seems no privileages for that, i wasn't able to delete this post also in order to make a new one.

Thanks for your kind help.
  #5 (permalink)  
Old 07-05-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,934
If you are using ksh93

Code:
$ printf "%(%Y%m%d %H:%M:%S)T\n" "now"
20080705 15:44:32
$ printf "%(%Y%m%d %H:%M:%S)T\n" "next month"
20080801 00:00:00
$

  #6 (permalink)  
Old 07-05-2008
rosalinda rosalinda is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 15
no i am using sh script, i would like to have this dates as variable which can be used by another scripts.
Thanks.
  #7 (permalink)  
Old 07-05-2008
rosalinda rosalinda is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 15
I am using sh script .
I would like to have this dates as variables to be able to use it in other by other scripts.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0