HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Shell Script Question.
Operating System - HP-UX
1834254
Members
1974
Online
110066
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2001 05:40 PM
08-01-2001 05:40 PM
Hi,
I was wondering if there was someone who would know an easy way to get the date from yesterday generated in a shell script. What I am doing is outputting a file called YYYY_MM_DD from a script, the only issue is that I want the date to be yesterday not today.
Any ideas?
Jason
I was wondering if there was someone who would know an easy way to get the date from yesterday generated in a shell script. What I am doing is outputting a file called YYYY_MM_DD from a script, the only issue is that I want the date to be yesterday not today.
Any ideas?
Jason
Why ?
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2001 06:28 PM
08-01-2001 06:28 PM
Solution
Hello,
Here is a recent thread for a similar question. Some of the replies included scripts that will calculate the previous dates. If you have Perl loaded on your machine it also makes it easy to do this.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x6e92ee3e323bd5118fef0090279cd0f9,00.html
JP
Here is a recent thread for a similar question. Some of the replies included scripts that will calculate the previous dates. If you have Perl loaded on your machine it also makes it easy to do this.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x6e92ee3e323bd5118fef0090279cd0f9,00.html
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2001 06:28 PM
08-01-2001 06:28 PM
Re: Shell Script Question.
Hello if your script runs the date that you want and you want to save the file with that date. Put this on the bottom
stamp=`date +%m%d%H%M`
cp yourfile.txt youfile.$stamp
if you want to calulate a date.
Here is a post that helped me out with that.You can also do a search (top left hand)
for date and you will find other post on this subject.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x6cc253921f1ad5118fef0090279cd0f9,00.html
Richard
stamp=`date +%m%d%H%M`
cp yourfile.txt youfile.$stamp
if you want to calulate a date.
Here is a post that helped me out with that.You can also do a search (top left hand)
for date and you will find other post on this subject.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x6cc253921f1ad5118fef0090279cd0f9,00.html
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2001 12:56 PM
08-02-2001 12:56 PM
Re: Shell Script Question.
I am working for a company that made this simple. From CRON at 23:59 as root they create a file /tmp/yesterday with 444 as the permissions. They put the output of the date command in it. Everyone knows it is there and they agreed on a format. Now any time they need yesterdays date they can get it with cat /tmp/yesterday. VERY SIMPLE SOLUTION.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP