Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!yale!ox.com!mudos!mju From: mju@mudos.ann-arbor.mi.us (Marc Unangst) Newsgroups: comp.unix.questions Subject: Re: Changing .zoo archive to .lzh archive: help! Keywords: Unique directory names Message-ID: <1991Feb17.160724.10421@mudos.ann-arbor.mi.us> Date: 17 Feb 91 16:07:24 GMT References: <885@caslon.cs.arizona.edu> Distribution: usa Organization: The Programmer's Pit Stop, Public Access Unix +1 313 665 2832 Lines: 34 In article <885@caslon.cs.arizona.edu> dave@cs.arizona.edu (Dave P. Schaumann) writes: >Where "no-dot" is a simple program that echos back everything in argv[] that >isn't "." or ".." Why bother? Why not just use ".??*", and save the overhead of writing and executing another program? >getpid() and some unlikely template, like "xx-######-temp". What I need to Again, why bother? The shell already provides access to your PID in the form of the "$" variable. So, you can just do this: temp=$$xx.temp # ... mkdir $temp # ... > 1. Is it a reasonable assumption that no two concurrent getpid()'s will > return the same value? Yes; a process ID is just that -- a unique identifier assigned to an individual process. Since a great many things would break if two concurrently executing processes could have the same PID, Unix kernel writers go to great lengths to make sure updates to the process table are atomic. > 2. Is there a better way to do this? See above. -- Marc Unangst | "I think I have a bad disk. Even though I mju@mudos.ann-arbor.mi.us | folded it to fit into my drive, it still ...!umich!leebai!mudos!mju | doesn't work..." -Caller to a tech support line