Need help with tcsh shell script
Derek Martin
ddm at pizzashack.org
Mon May 28 11:56:26 EDT 2001
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:
then
...
<if block code>
...
fi
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 pizzashack.org | GnuPG Key ID: 0x81CFE75D
Retrieve my public key at http://pgp.mit.edu
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).
More information about the Discuss
mailing list