- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need some scripting help
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
Forums
Discussions
Discussions
Discussions
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
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
10-03-2003 04:06 AM
10-03-2003 04:06 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2003 04:10 AM
10-03-2003 04:10 AM
Re: Need some scripting help
For example
cp sourcefile $RANDOM
cp sourcefile newfile$(date +%d)
etc etc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2003 04:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2003 04:43 AM
10-03-2003 04:43 AM
Re: Need some scripting help
DATAFILE=PATH/FILENAME
if test -s "$DATAFILE"
then
OLD_VERSION_NUM=`cat $DATAFILE`
else
OLD_VERSION_NUM="0"
fi
NEW_VERSION_NUM=`echo "$OLD_VERSION_NUM + 1"|bc`
echo "$NEW_VERSION_NUM">$DATAFILE
cp file file.$NEW_VERSION_NUM
This sets a default version of 1 if the data file is missing, and increments whatever is in the file if it isn't missing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2003 02:20 PM
10-03-2003 02:20 PM
Re: Need some scripting help
Here's my personal preference:
cp $file $file.`date +%Y%m%d`.`date +%H%M`
An example of the created file is myfile.20031004.1018
Preferred this for ease of sorting. Hope this helps. Regards.
Steven Sim Kok Leong