[Logcheck-commits] CVS logcheck/src

CVS User maks-guest logcheck-devel@lists.alioth.debian.org
Mon, 20 Sep 2004 17:09:54 -0600


Update of /cvsroot/logcheck/logcheck/src
In directory haydn:/tmp/cvs-serv13720/src

Modified Files:
	logcheck 
Log Message:

use [[ and ]] instead of [ and ], results in:

max@foo$  if [ $(wc -c <bla)  -lt $(tail -n 1 /var/lib/logcheck/offset.var.log.syslog) ]; then echo bla; fi
tail: cannot open `/var/lib/logcheck/offset.var.log.syslog' for reading: Permission denied
bash: [: 19: unary operator expected

max@foo$ if [[ $(wc -c <bla)  -lt $(tail -n 1 /var/lib/logcheck/offset.var.log.syslog) ]]; then echo bla; fi
tail: cannot open `/var/lib/logcheck/offset.var.log.syslog' for reading: Permission denied

found only one case where transition was needed please correct me if wrong.
construct needs bash >= 2.02.


--- /cvsroot/logcheck/logcheck/src/logcheck	2004/09/20 22:33:30	1.86
+++ /cvsroot/logcheck/logcheck/src/logcheck	2004/09/20 23:09:53	1.87
@@ -22,7 +22,7 @@
 # along with Logcheck; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-# $Id: logcheck,v 1.86 2004/09/20 22:33:30 maks-guest Exp $
+# $Id: logcheck,v 1.87 2004/09/20 23:09:53 maks-guest Exp $
 
 if [ $UID == 0 ]; then
     echo "logcheck should not be run as root. Use su to invoke logcheck:"
@@ -386,7 +386,7 @@
     if [ -f $file ]; then
 	offsetfile="$STATEDIR/offset$(echo $file|tr / .)"
 	if [ -s $offsetfile -a -r $offsetfile ]; then
-	    if [ $(wc -c < $file) -lt $(tail -n 1  $offsetfile) ]; then
+	    if [[ $(wc -c < $file) -lt $(tail -n 1  $offsetfile) ]]; then
 		if [ -e $file.0 ]; then
 	        # assume the log is rotated by savelog(8)
 		    debug "Running logtail on rotated: $file.0"