home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / shell / 5171 < prev    next >
Encoding:
Internet Message Format  |  1992-12-27  |  2.4 KB

  1. Xref: sparky comp.unix.shell:5171 comp.unix.questions:14980
  2. Path: sparky!uunet!paladin.american.edu!gatech!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!news.lth.se!satie-11!dat91uni
  3. From: dat91uni@ludat.lth.se (Urban Nilsson)
  4. Newsgroups: comp.unix.shell,comp.unix.questions,comp.unix.wizard
  5. Subject: a 'simple' (?) csh question
  6. Message-ID: <1992Dec27.085912.11886@lth.se>
  7. Date: 27 Dec 92 08:59:12 GMT
  8. Sender: news@lth.se
  9. Reply-To: dat91uni@ludat.lth.se
  10. Followup-To: comp.unix.shell,dat91uni@ludat.lth.se
  11. Organization: Dept. of Computer Science, University of Lund.
  12. Lines: 70
  13.  
  14.  
  15. Yo !
  16.  
  17. I have this small problem with a shell program I've done
  18. I create this bunch of files in /tmp and afterward when it's
  19. time to get them together i miss some files ! why, I cant find
  20. any reason to it, if I dont delete them every file that I need
  21. is there, why dont I get all the files in the resultfile ???
  22.  
  23. cheers / UNI :-(
  24.  
  25.  
  26. ---
  27. #! /bin/csh 
  28.  
  29. #  known bugs/limitations:
  30. #     if a user is logged in over midnight the program can
  31. #      give a wrong result.
  32. #     solution: get a real life!
  33. #
  34.  
  35. set temp1 = /tmp/ww1$$
  36. set temp2 = /tmp/ww2$$
  37.  
  38. switch($#argv)
  39.    case 1:
  40.       foreach name (bach satie)
  41.          foreach num (1 2 3 4 5 6 7 8 9 10)
  42.             (echo `rsh $name-$num last $argv[1] | head -1 | cut -c41-` $name-$num &)>! $temp1$name$num
  43.          end
  44.       end
  45.       foreach num (11 12 13 14 15 16)
  46.             (echo `rsh $name-$num last $argv[1] | head -1 | cut -c41-` $name-$num &) >! $temp1$name$num
  47.       end
  48.       wait
  49.       cat $temp1* >! $temp2
  50.       sleep 3
  51.       set stilltst = `grep "still" $temp2`
  52.       if ("$stilltst" == "") then
  53.          set slask = `sort +0rM +1nr +2nr $temp2 | head -1`
  54.          if ("$slask" == "") exit 1
  55.          echo $argv[1] was last on : $slask
  56.       else
  57.          echo -n "$argv[1] is still on at "
  58.          echo `echo $stilltst | cut -c30-`
  59.       endif
  60.       unalias rm
  61.       rm -f $temp1* >& /dev/null
  62.       rm -f $temp2* >& /dev/null
  63.    breaksw
  64.    default:
  65.       echo "usage: ww <username>"
  66.       exit 1
  67. endsw
  68.  
  69. exit 0
  70. ---
  71.  
  72. Thanks in advance, I'd prefere respons with e-mail.
  73.  
  74.  
  75. ---
  76. Lev Gott ...    , Have a nice life ...
  77.  
  78. Urban Nilsson  (UNI)                  | Snailmail: Magistergatan 2
  79. Internet:      dat91uni@ludat.lth.se  |            252 27 Helsingborg
  80. Phone, voice:  +46 42 182154          |            Sweden
  81.                                       |
  82. IgorMud:       Cedric                 |
  83. ---
  84.