Module Name: src Committed By: rillig Date: Sat Mar 15 22:01:16 UTC 2025
Modified Files: src/bin/expr: expr.1 src/tests/bin/expr: t_expr.sh Log Message: expr: improve portability, fix typo Suggested by Robert Elz. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/bin/expr/expr.1 cvs rdiff -u -r1.14 -r1.15 src/tests/bin/expr/t_expr.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/expr/expr.1 diff -u src/bin/expr/expr.1:1.39 src/bin/expr/expr.1:1.40 --- src/bin/expr/expr.1:1.39 Sat Mar 15 16:02:53 2025 +++ src/bin/expr/expr.1 Sat Mar 15 22:01:16 2025 @@ -1,4 +1,4 @@ -.\" $NetBSD: expr.1,v 1.39 2025/03/15 16:02:53 rillig Exp $ +.\" $NetBSD: expr.1,v 1.40 2025/03/15 22:01:16 rillig Exp $ .\" .\" Copyright (c) 2000, 2003, 2025 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -43,7 +43,7 @@ utility evaluates the expression consist .Ar operand arguments and writes the result on standard output. .Pp -Each operand is a separate arguments to the +Each operand is a separate argument to the .Nm utility. Characters special to the command interpreter must be escaped. Index: src/tests/bin/expr/t_expr.sh diff -u src/tests/bin/expr/t_expr.sh:1.14 src/tests/bin/expr/t_expr.sh:1.15 --- src/tests/bin/expr/t_expr.sh:1.14 Sat Mar 15 15:36:12 2025 +++ src/tests/bin/expr/t_expr.sh Sat Mar 15 22:01:16 2025 @@ -1,4 +1,4 @@ -# $NetBSD: t_expr.sh,v 1.14 2025/03/15 15:36:12 rillig Exp $ +# $NetBSD: t_expr.sh,v 1.15 2025/03/15 22:01:16 rillig Exp $ # # Copyright (c) 2007 The NetBSD Foundation, Inc. # All rights reserved. @@ -30,7 +30,8 @@ # usage: test_expr operand ... result|error test_expr() { i=1 - while [ $((i++)) -lt $# ]; do + while [ $i -lt $# ]; do + i=$((i + 1)) set -- "$@" "$1" shift done