home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / shell / 4577 < prev    next >
Encoding:
Text File  |  1992-11-07  |  2.1 KB  |  61 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!stanford.edu!agate!netsys!ukma!kherron
  3. From: kherron@ms.uky.edu (Kenneth Herron)
  4. Subject: Re: C-Shell question
  5. References: <1992Nov3.130759.27280@eua.ericsson.se> 
  6.     <1992Nov4.080338.9458@eua.ericsson.se> 
  7.     <1992Nov5.020850.572@news.csd.sgi.com> 
  8.     <1992Nov6.115704.23205@cs.utwente.nl>
  9. Message-ID: <1992Nov6.113910.21207@ms.uky.edu>
  10. Distribution: na
  11. Date: Fri, 6 Nov 1992 16:39:10 GMT
  12. Organization: University Of Kentucky, Dept. of Math Sciences
  13. Lines: 46
  14.  
  15. ahoekstr@cs.utwente.nl (Andre D. Hoekstra) writes:
  16.  
  17. >>The exit status you get is from the command "rsh" and not from the script it
  18. >>executes. Since "rsh" completes normally, you will see "0" which is its 
  19. >>"completion ok" status. If you do an "echo $status" inside the script, you
  20. >>might see the exit status of the command of rm.
  21.  
  22. >The original question was:
  23.  
  24. >I have a script that goes:
  25.  
  26. >#!/bin/csh # ??
  27.  
  28. >/bin/rm -f file
  29.  
  30. >if ( $status ) then blabla
  31.  
  32. >#end of script; exit
  33.  
  34. >When I run this script normallly it works OK, but when I try to
  35. >rsh somehost script
  36. >I always get a $status of 0
  37.  
  38. No, this *wasn't* the original question.  In the original question,
  39. the rm command line didn't have the -f option.  This makes a *lot*
  40. of difference.  On at least the two systems I tried here, rm -f
  41. always results in a 0 exit code no matter how many files rm was able
  42. to remove.  I suspect the answer to your question is simply that rm 
  43. works differently on the system you're rsh'ing to.
  44.  
  45. Let me suggest that in the future you include the actual script--edit
  46. out the irrelevant parts if it's big--rather than retyping it in your
  47. post.
  48.  
  49. As for Mr. Vidya and the others, it sounds like they didn't read your
  50. question closely enough and thought you were doing something like
  51.  
  52.     #! /bin/csh
  53.     rsh foo /bin/rm file
  54.     if ( $status ) ...
  55.  
  56. -- 
  57. Kenneth Herron                                              kherron@ms.uky.edu
  58. University of Kentucky                                         +1 606 257 2975
  59. Dept. of Mathematics     "Your ball goes over them, it sails off the edge into
  60. a huge cauldren of fire-breathing dragons."  "And they call this a par three?"
  61.