The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
addition in sh shell cfg UNIX for Dummies Questions & Answers 1 09-28-2008 03:53 PM
Simple addition, help. Bandit390 Shell Programming and Scripting 3 09-23-2008 02:46 PM
addition email-lalit Shell Programming and Scripting 2 08-06-2008 05:58 PM
Addition problem onlyroshni Shell Programming and Scripting 2 12-10-2007 02:11 PM
floating point addition ravi raj kumar Shell Programming and Scripting 8 12-22-2006 02:47 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-13-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
date addition

i have a script called date_add.sh written in k_shell

My shell script requirement is that it accepts a date from the user in the format YYYY-MM-DD and then it shows all the 15 days later day availaible in the current year

if date accepted from user is 2008-10-13,then the o/p sholud be
2008-10-28
2008-11-12
2008-11-27
2008-12-12
2008-12-27
-----------------------------------------------------------------------

How to put this logic in a loop? Also how to convert Epoch days into format YYYY-MM-DD

Current_day=`perl -e 'print int(time/86400);'`--------------------16145

but the below command is not working

perl -e '@d=localtime ((stat(shift))[9]); printf "%4d-%02d-%02d\n", $d[5]+1900,$d[4]+1,$d[3]' Current_day

Last edited by ali560045; 10-13-2008 at 06:44 AM..
 

Bookmarks

Tags
perl, perl shift, shift, shift perl

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 11:17 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