Advertisement

06.06.2007 at 11:52PM PDT, ID: 22618342
[x]
Attachment Details

get yesterdays date into a unix variable

Asked by mbergeby in HP-UX Unix, Unix Operating Systems, Unix Systems Programming

Tags: date, unix, yesterday, variable, get

Hi,
I'm working in HP-ux 11 and I'm trying to get yesterdays date into a variable that I can use later on in a script.
I use the format:
DATE=`date '+%d-%b-%Y'`
which gives me i.e. 01-Jan-2007
I make it uppercase and gets it into a variable with
export Y_DATE=$(printf "%s\n" "$DATE" | tr '[a-z]' '[A-Z]')
which gives me 01-JAN-2007 as value in Y_DATE
The question is how can I get the result to be 31-DEC-2006 in Y_DATE??

Thankfull for any helpStart Free Trial
[+][-]06.07.2007 at 12:38AM PDT, ID: 19231472

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.07.2007 at 12:40AM PDT, ID: 19231473

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.07.2007 at 01:10AM PDT, ID: 19231598

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.07.2007 at 01:13AM PDT, ID: 19231605

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: HP-UX Unix, Unix Operating Systems, Unix Systems Programming
Tags: date, unix, yesterday, variable, get
Sign Up Now!
Solution Provided By: nixfreak
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.07.2007 at 01:33AM PDT, ID: 19231686

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32