- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to generate random file name on HPUX?
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
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
тАО04-12-2005 11:13 PM
тАО04-12-2005 11:13 PM
How to generate random file name on HPUX?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 11:23 PM
тАО04-12-2005 11:23 PM
Re: How to generate random file name on HPUX?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 11:27 PM
тАО04-12-2005 11:27 PM
Re: How to generate random file name on HPUX?
/tmp/fileWgK3Cy
lt09:/home/merijn 107 >
in a shell
# TMPNAM=$(perl -MPOSIX=tmpnam -e'print POSIX::tmpnam')
If you were to use Perl as the scripting language itself, do
# man File::Temp
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 11:41 PM
тАО04-12-2005 11:41 PM
Re: How to generate random file name on HPUX?
It is a random number generator (an integer between 0 and 32767).
"touch $RANDOM.txt" will create random file name with txt extension.
Regards,
Sergejs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 11:46 PM
тАО04-12-2005 11:46 PM
Re: How to generate random file name on HPUX?
or if you want alphabetical:
echo `expr $RANDOM % 26` `expr $RANDOM % 26` | awk '{alphabet = "abcdefghijklmnopqrstuvwxyz"; printf("%s%s\n", substr(alphabet,$1,1), substr(alphabet,$2,1)); }'
(thanks to harry d brown jnr)
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-13-2005 12:41 AM
тАО04-13-2005 12:41 AM
Re: How to generate random file name on HPUX?
When scripting in the Korn shell I do the following:
tmpfile="/var/tmp/tmpfile.$$`date +%s`"
The $$ variable (in ksh) returns the PID of the current process, and `date +%s` returns (I believe) the number of seconds offset from the 'epoc'. Combined, the two of them are always going to create a unique number.
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-13-2005 04:56 AM
тАО04-13-2005 04:56 AM