home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.shell:5171 comp.unix.questions:14980
- Path: sparky!uunet!paladin.american.edu!gatech!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!news.lth.se!satie-11!dat91uni
- From: dat91uni@ludat.lth.se (Urban Nilsson)
- Newsgroups: comp.unix.shell,comp.unix.questions,comp.unix.wizard
- Subject: a 'simple' (?) csh question
- Message-ID: <1992Dec27.085912.11886@lth.se>
- Date: 27 Dec 92 08:59:12 GMT
- Sender: news@lth.se
- Reply-To: dat91uni@ludat.lth.se
- Followup-To: comp.unix.shell,dat91uni@ludat.lth.se
- Organization: Dept. of Computer Science, University of Lund.
- Lines: 70
-
-
- Yo !
-
- I have this small problem with a shell program I've done
- I create this bunch of files in /tmp and afterward when it's
- time to get them together i miss some files ! why, I cant find
- any reason to it, if I dont delete them every file that I need
- is there, why dont I get all the files in the resultfile ???
-
- cheers / UNI :-(
-
-
- ---
- #! /bin/csh
-
- # known bugs/limitations:
- # if a user is logged in over midnight the program can
- # give a wrong result.
- # solution: get a real life!
- #
-
- set temp1 = /tmp/ww1$$
- set temp2 = /tmp/ww2$$
-
- switch($#argv)
- case 1:
- foreach name (bach satie)
- foreach num (1 2 3 4 5 6 7 8 9 10)
- (echo `rsh $name-$num last $argv[1] | head -1 | cut -c41-` $name-$num &)>! $temp1$name$num
- end
- end
- foreach num (11 12 13 14 15 16)
- (echo `rsh $name-$num last $argv[1] | head -1 | cut -c41-` $name-$num &) >! $temp1$name$num
- end
- wait
- cat $temp1* >! $temp2
- sleep 3
- set stilltst = `grep "still" $temp2`
- if ("$stilltst" == "") then
- set slask = `sort +0rM +1nr +2nr $temp2 | head -1`
- if ("$slask" == "") exit 1
- echo $argv[1] was last on : $slask
- else
- echo -n "$argv[1] is still on at "
- echo `echo $stilltst | cut -c30-`
- endif
- unalias rm
- rm -f $temp1* >& /dev/null
- rm -f $temp2* >& /dev/null
- breaksw
- default:
- echo "usage: ww <username>"
- exit 1
- endsw
-
- exit 0
- ---
-
- Thanks in advance, I'd prefere respons with e-mail.
-
-
- ---
- Lev Gott ... , Have a nice life ...
-
- Urban Nilsson (UNI) | Snailmail: Magistergatan 2
- Internet: dat91uni@ludat.lth.se | 252 27 Helsingborg
- Phone, voice: +46 42 182154 | Sweden
- |
- IgorMud: Cedric |
- ---
-