home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!stanford.edu!leland.Stanford.EDU!dkeisen
- From: dkeisen@leland.Stanford.EDU (Dave Eisen)
- Subject: Re: C-Shell question
- Message-ID: <1992Nov7.183512.15357@leland.Stanford.EDU>
- Sender: news@leland.Stanford.EDU (Mr News)
- Organization: Sequoia Peripherals, Inc.
- References: <1992Nov5.020850.572@news.csd.sgi.com> <1992Nov6.115704.23205@cs.utwente.nl> <1992Nov6.113910.21207@ms.uky.edu>
- Distribution: na
- Date: Sat, 7 Nov 92 18:35:12 GMT
- Lines: 34
-
- In article <1992Nov6.113910.21207@ms.uky.edu> kherron@ms.uky.edu (Kenneth Herron) writes:
- >
- >As for Mr. Vidya and the others, it sounds like they didn't read your
- >question closely enough and thought you were doing something like
- >
- > #! /bin/csh
- > rsh foo /bin/rm file
- > if ( $status ) ...
-
- (As opposed to rm -f)
-
- No. Mr. Vidya and the others were right, the -f has nothing
- at all to do with the functionaltiy of this script.
-
- The script you wrote will always have $status set to 0, regardless
- of whether or not file exists on foo (assuming you were successfully
- able to execute the rm command on foo). The problem with this script
- is that it depends on the exit status of rsh which will be 0 even
- if the exit status of rm isn't.
-
- The only way to find out if the rm worked is to do the following:
-
- #! /bin/csh
-
- set stat = `rsh foo 'rm file >& /dev/null ; echo $status '`
-
- if ( $stat ) ....
-
-
- --
- Dave Eisen Sequoia Peripherals: (415) 967-5644
- dkeisen@leland.Stanford.EDU Home: (415) 321-5154
- There's something in my library to offend everybody.
- --- Washington Coalition Against Censorship
-