home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.admin
- Path: sparky!uunet!gatech!paladin.american.edu!darwin.sura.net!spool.mu.edu!agate!dog.ee.lbl.gov!news!avalon.nwc.navy.mil!peewee!erik
- From: erik@peewee.nwc.navy.mil (Erik van Bronkhorst Code 3814 Phone 939-1421)
- Subject: Re: showing working dirs of each users
- Message-ID: <Bzoo7K.EDH@avalon.nwc.navy.mil>
- Sender: usenet@avalon.nwc.navy.mil (NWC News Admin)
- Organization: NAVAIRWARCENWPNDIV, China Lake
- References: <1992Dec21.082746.23803@latcs1.lat.oz.au> <78677@hydra.gatech.EDU>
- Date: Tue, 22 Dec 1992 23:06:55 GMT
- Lines: 32
-
- In article <78677@hydra.gatech.EDU> glenns@eas.gatech.edu writes:
- >In <1992Dec21.082746.23803@latcs1.lat.oz.au> wongm@latcs1.lat.oz.au (M.C. Wong) writes:
- >> I wonder if there is any utility that shows which working dir each
- >> of the users are in, much like the finger and w command but also shows
- >> where they are. Thank you !!
- >
- >Not that I know of; I do know that it would be a royal pain to do (probably
- >involving C and setuid executables) on a SysV box... but if you luck out
- >and have BSD or some variant thereof, you can probably cobble something
- >together in a shell script, starting like
- >
- >ps agxeww | egrep -e [ -][t-][ck]sh | awk {some really funky stuff here}
- >
-
- Miracle of miracles! I had never heard of the "eww" options to ps!
- On my Sun (4.1.1) this seems to work as long as the user in question
- is doing something other than just sitting there logged in. Try as
- I might, I could not get the -csh entry to show a PWD. I suspect that
- since it is = to HOME at login, it is not retained. (yes, I WAS
- in another dir when I tried it on myself).
-
- #
- users=`who | field 1`
- for user in $users ; do
- echo $user
- ps aueww | grep "USER=$user" | grep PWD | sed 's/^.*PWD=\([^ ]*\).*$/\1/' | sort -u
- done
-
- Crude but I never bothered to decipher awk.....
- --
- Erik van Bronkhorst KC6UUT DoD#4342585443 AMA#[classified]
- "Truth is false and logic lost, now the fourth dimension is crossed..."
-