Monday, February 16, 2009
Linux Shell Meets Java UID
Java Unique ID generator (java.rmi.server.UID().toString()) can come in handy when needing unique directory names. However some basic Linux shell commands like ls, cd, rm, etc. may not like the "-" part in directory names like "-2374f8d0", Either "ls ./-2374f8d0" or "rm -- -2374f8d0" can do the trick.
Subscribe to:
Post Comments (Atom)
4 comments:
There are many other ways of solving this problem without resorting to Java. There's a command mktemp (http://linux.die.net/man/1/mktemp), and some shells populate a variable $RANDOM (http://www.cyberciti.biz/tips/shell-scripting-bash-how-to-create-temporary-random-file-name.html), and another for the process ID.
Hey thanks! That's good information to know!
Excuse for that I interfere … here recently. But this theme is very close to me. Write in PM.
I am sorry, that has interfered... This situation is familiar To me. I invite to discussion. Write here or in PM.
Post a Comment