[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28461: erreurs
From: |
Assaf Gordon |
Subject: |
bug#28461: erreurs |
Date: |
Thu, 14 Sep 2017 12:00:53 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
tag 28461 notabug
stop
Hello,
On 2017-09-14 11:43 AM, Eric Mariaud wrote:
> address@hidden:~/Bureau$ expr 2 + 3
> 5
> address@hidden:~/Bureau$ expr 2 * 3
> expr: erreur de syntaxe
The asterisks ( * ) character has special meaning on the shell,
which you can observe by comparing the output of:
echo 2 + 3
vs
echo 2 * 3
Technically, the shell replaces the '*' character with the list of
all files in the current directory. The 'expr' program never sees it.
Add single-quotes around the '*' character to send it as-is to 'expr':
$ expr 2 '*' 3
6
Alternatively,
Most modern shells support built-in basic arithmetic using
the '$(())' syntax (dollar-sign and two parentheses):
$ echo $((2*3))
6
As such, I'm marking this as not-a-bug, but discussion can continue by
replying to this thread.
regards,
- assaf
- bug#28461: erreurs, Eric Mariaud, 2017/09/14
- bug#28461: erreurs,
Assaf Gordon <=
- bug#28461: erreurs, Bernhard Voelker, 2017/09/15
- bug#28461: erreurs, Assaf Gordon, 2017/09/15
- bug#28461: erreurs, Pádraig Brady, 2017/09/15
- bug#28461: erreurs, Jim Meyering, 2017/09/15
- bug#28461: erreurs, Pádraig Brady, 2017/09/16
- bug#28461: erreurs, Assaf Gordon, 2017/09/17
- bug#28461: erreurs, Jim Meyering, 2017/09/17
- bug#28461: erreurs, Assaf Gordon, 2017/09/20
- bug#28461: erreurs, R0b0t1, 2017/09/16
- bug#28461: erreurs, Bernhard Voelker, 2017/09/16