Results 1 to 3 of 3
ok this one has got me going nuts!
I and trying to make a script that looks at a spacific line in a file to se if ther is any ...
- 10-06-2007 #1Just Joined!
- Join Date
- Apr 2007
- Posts
- 12
IS it a blank line?
ok this one has got me going nuts!
I and trying to make a script that looks at a spacific line in a file to se if ther is any text there. but the problem is no mater what I try I get an error.
Any thoughts??
the file "45.txt" has a number of blank lines with no text and when one of these lines are selected is when it error's out.
Her is what I have so far
I get the following errorCode:#! /bin/csh set blank = "" set line = $1 set temp = `cat 45.txt | head -$line | tail -1` if ( $temp == $blank ) then echo "It is blank!" else echo "It is not blank" endif
": Event not found.
have also tried
but with no luck.Code:#! /bin/csh set blank = "" set line = $1 set temp = `cat 45.txt | head -$line | tail -1` if ( $temp == "" ) then echo "It is blank!" else echo "It is not blank" endif
- 10-06-2007 #2Linux User
- Join Date
- Aug 2006
- Posts
- 458
overall , there should be specific problem that you want to solve. Why don't you specify what problem you are facing ?
- 10-06-2007 #3Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
Most people avoid csh for scripting, finding that the Bourne shell family does not have the irritating quirks of the csh family.
If you must use csh, then I have found that most error messages involving "events" are related to the use of "!". Remove that from the echo line and try again.
I tried to reproduce your problem with a more modern version of csh called tcsh, and I was not successful, so another alternative might be to try that. Here is a forced example of an event message:
Producing:Code:#!/bin/csh echo Here is !2000
Best wishes ... cheers, drlCode:% ./s2 2000: Event not found.
Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )


Reply With Quote