1 This file is let.def, from which is created let.c.
2 It implements the builtin "let" in Bash.
4 Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
6 This file is part of GNU Bash, the Bourne Again SHell.
8 Bash is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 1, or (at your option) any later
13 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License along
19 with Bash; see the file COPYING. If not, write to the Free Software
20 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25 $SHORT_DOC let arg [arg ...]
26 Each ARG is an arithmetic expression to be evaluated. Evaluation
27 is done in long integers with no check for overflow, though division
28 by 0 is trapped and flagged as an error. The following list of
29 operators is grouped into levels of equal-precedence operators.
30 The levels are listed in order of decreasing precedence.
34 * / % multiplication, division, remainder
35 + - addition, subtraction
37 == != equality inequality
40 Shell variables are allowed as operands. The name of the variable
41 is replaced by its value (coerced to a long integer) within
42 an expression. The variable need not have its integer attribute
43 turned on to be used in an expression.
45 Operators are evaluated in order of precedence. Sub-expressions in
46 parentheses are evaluated first and may override the precedence
49 If the last ARG evaluates to 0, let returns 1; 0 is returned
55 /* Arithmetic LET function. */
63 builtin_error ("argument (expression) expected");
64 return (EXECUTION_FAILURE);
69 ret = evalexp (list->word->word);
74 return (EXECUTION_FAILURE);
76 return (EXECUTION_SUCCESS);