Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need help with tcsh shell script

On Mon, May 28, 2001 at 09:44:31AM -0400, Scott Ehrlich wrote:
> Hello to all:

Hi there!

> Five or more years ago, the following piece of shell code worked fine. Now
> that I have a need to use it again, OS upgrades/enhancements has broken it
> and I am hoping you can help fix it.

The line you gave should work fine under sh/bash except that you have a
small type-o:

> The code is:
> if [ `diff /home/scott/old-file /home/scott/new-file | wc -c` -ne 0]
                                                                    0 ]

The space after the zero is required.  And to make sure that the rest
of the if clause is not your problem, in sh/bash, you would then
follow it with a then (on a seperate line, or after a ';') like this:

       <if block code>

Also note that while diff and wc are usually in a user's $PATH, if
they are not you should specify the full path to them.  I don't know
csh very well but I believe the equivalent of your line would be this:

  if (`diff /home/scott/old-file /home/scott/new-file | wc -c` != 0)

Hope that helps.

Derek Martin          |   Unix/Linux geek
ddm at    |   GnuPG Key ID: 0x81CFE75D
Retrieve my public key at

Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at (Subject line is ignored).

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /