- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to set actual date in filename
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
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
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
тАО07-29-2003 01:54 AM
тАО07-29-2003 01:54 AM
For example: backup-29072003-1434.tar.
I tried to use an environment variable:
export ACTDATE=date +%d%m%Y, but there was an error:
ksh: +%d%m%Y: is not an identifier
Is there anybody with a tip for me?
Thanks very much in advance
Best regards
Daniel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2003 01:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2003 02:05 AM
тАО07-29-2003 02:05 AM
Re: How to set actual date in filename
you need to enclose the date ... command in backticks like this:
export ACTDATE=`date +%d%m%Y`
This tells the shell to execute the string between the backticks as a command and return the result.
HTH,
Michael.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2003 02:09 AM
тАО07-29-2003 02:09 AM
Re: How to set actual date in filename
Try this in a script :
DATUM=`date '+%y-%m-%d.%H:%M'`
export DATUM
#
mv oldfile oldfile_${DATUM}
#
Rgds
Alexander M. Ermes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2003 02:11 AM
тАО07-29-2003 02:11 AM
Re: How to set actual date in filename
Best Regards
Daniel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2003 03:23 AM
тАО07-29-2003 03:23 AM
Re: How to set actual date in filename
I want like to give you another tip. If you tar you backup first in a diretory you will get a file that is called in your case
backup-29072003-1434.tar
Then you backup this dir with your backup sw on tape. But what happens after couple of month and you want delete the backups from the first two weeks in this directory? You go in the directory and you do an ll
# ll ( I know ll shows more - short form )
...
backup-01042003-1434.tar
backup-01052003-1434.tar
backup-01062003-1434.tar
...
backup-07042003-1434.tar
...
backup-07072003-1434.tar
...
backup-29072003-1434.tar
backup-30072003-1434.tar
backup-31072003-1434.tar
You see for a month it is O.K but if you have backups for more than a month in this directory the sorting order of your LC_NUMERIC will sort in not very logical.
But if you sort first YEAR-MONTH-DAY_TIME
you get first the oldest and the the youngest backups showed by ll command.
# ll
...
backup-20030401-1434.tar
backup-20030402-1434.tar
backup-20030403-1434.tar
...
backup-20030501-1434.tar
backup-20030502-1434.tar
backup-20030503-1434.tar
...
backup-20030729-1434.tar
backup-20030730-1434.tar
backup-20030731-1434.tar
...
So sometimes it could be better to change you time variable to
ACTDATE=`date +%Y%m%d`
Does that make sense to you?
Roland
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2003 03:58 AM
тАО07-29-2003 03:58 AM
Re: How to set actual date in filename
Cheryl
(Feedback only: no points please.)