expr.1 (140169) | expr.1 (140353) |
---|---|
1.\" -*- nroff -*- 2.\"- 3.\" Copyright (c) 1993 Winning Strategies, Inc. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 14 unchanged lines hidden (view full) --- 23.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30.\" | 1.\" -*- nroff -*- 2.\"- 3.\" Copyright (c) 1993 Winning Strategies, Inc. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 14 unchanged lines hidden (view full) --- 23.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30.\" |
31.\" $FreeBSD: head/bin/expr/expr.1 140169 2005-01-13 08:46:19Z ru $ | 31.\" $FreeBSD: head/bin/expr/expr.1 140353 2005-01-16 16:41:59Z ru $ |
32.\" 33.Dd July 12, 2004 34.Dt EXPR 1 35.Os 36.Sh NAME 37.Nm expr 38.Nd evaluate expression 39.Sh SYNOPSIS --- 135 unchanged lines hidden (view full) --- 175For historical reasons, defining the environment variable 176.Ev EXPR_COMPAT 177also enables compatibility mode. 178.Sh ENVIRONMENT 179.Bl -tag -width ".Ev EXPR_COMPAT" 180.It Ev EXPR_COMPAT 181If set, enables compatibility mode. 182.El | 32.\" 33.Dd July 12, 2004 34.Dt EXPR 1 35.Os 36.Sh NAME 37.Nm expr 38.Nd evaluate expression 39.Sh SYNOPSIS --- 135 unchanged lines hidden (view full) --- 175For historical reasons, defining the environment variable 176.Ev EXPR_COMPAT 177also enables compatibility mode. 178.Sh ENVIRONMENT 179.Bl -tag -width ".Ev EXPR_COMPAT" 180.It Ev EXPR_COMPAT 181If set, enables compatibility mode. 182.El |
183.Sh EXIT STATUS 184The 185.Nm 186utility exits with one of the following values: 187.Bl -tag -width indent -compact 188.It 0 189the expression is neither an empty string nor 0. 190.It 1 191the expression is an empty string or 0. 192.It 2 193the expression is invalid. 194.El |
|
183.Sh EXAMPLES 184.Bl -bullet 185.It 186The following example (in 187.Xr sh 1 188syntax) adds one to the variable 189.Va a : 190.Dl "a=$(expr $a + 1)" --- 40 unchanged lines hidden (view full) --- 231.St -p1003.1-2001 , 232this is simple: 233.Dl "expr -- \*q$a\*q \&: \*q.*\*q" 234.It 235For portability to older systems, however, a more complicated command 236is required: 237.Dl "expr \e( \*qX$a\*q \&: \*q.*\*q \e) - 1" 238.El | 195.Sh EXAMPLES 196.Bl -bullet 197.It 198The following example (in 199.Xr sh 1 200syntax) adds one to the variable 201.Va a : 202.Dl "a=$(expr $a + 1)" --- 40 unchanged lines hidden (view full) --- 243.St -p1003.1-2001 , 244this is simple: 245.Dl "expr -- \*q$a\*q \&: \*q.*\*q" 246.It 247For portability to older systems, however, a more complicated command 248is required: 249.Dl "expr \e( \*qX$a\*q \&: \*q.*\*q \e) - 1" 250.El |
239.Sh DIAGNOSTICS 240The 241.Nm 242utility exits with one of the following values: 243.Bl -tag -width indent -compact 244.It 0 245the expression is neither an empty string nor 0. 246.It 1 247the expression is an empty string or 0. 248.It 2 249the expression is invalid. 250.El | |
251.Sh SEE ALSO 252.Xr sh 1 , 253.Xr test 1 , 254.Xr check_utility_compat 3 255.Sh STANDARDS 256The 257.Nm 258utility conforms to 259.St -p1003.1-2001 , 260provided that compatibility mode is not enabled. 261The 262.Fl e 263flag is an extension. | 251.Sh SEE ALSO 252.Xr sh 1 , 253.Xr test 1 , 254.Xr check_utility_compat 3 255.Sh STANDARDS 256The 257.Nm 258utility conforms to 259.St -p1003.1-2001 , 260provided that compatibility mode is not enabled. 261The 262.Fl e 263flag is an extension. |