var=$[3 * 2] seem conflict with intuitive perception
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am confused about the outer $
in var3=$[$var1 * $var2]
Suppose the following script:
$ var1=5; var2=6; var3=$[$var1 * $var2]; echo $var3
30
If $
is removed, it report error:
$ var1=5; var2=6; var3=[$var1 * $var2]; echo $var3
-bash: Algorithms: command not found
30
$ var=[3 * 2]; echo $var
-bash: Algorithms: command not found
[3*2]
I feel it very strange it to declare;
$ var=$[3 * 2]; echo $var
6
Perform very likely from intuitive perception:
$ var=$6; echo $var
It's odd.
What's the mechanism which force the syntax should do it this way?
bash
New contributor
add a comment |Â
up vote
0
down vote
favorite
I am confused about the outer $
in var3=$[$var1 * $var2]
Suppose the following script:
$ var1=5; var2=6; var3=$[$var1 * $var2]; echo $var3
30
If $
is removed, it report error:
$ var1=5; var2=6; var3=[$var1 * $var2]; echo $var3
-bash: Algorithms: command not found
30
$ var=[3 * 2]; echo $var
-bash: Algorithms: command not found
[3*2]
I feel it very strange it to declare;
$ var=$[3 * 2]; echo $var
6
Perform very likely from intuitive perception:
$ var=$6; echo $var
It's odd.
What's the mechanism which force the syntax should do it this way?
bash
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am confused about the outer $
in var3=$[$var1 * $var2]
Suppose the following script:
$ var1=5; var2=6; var3=$[$var1 * $var2]; echo $var3
30
If $
is removed, it report error:
$ var1=5; var2=6; var3=[$var1 * $var2]; echo $var3
-bash: Algorithms: command not found
30
$ var=[3 * 2]; echo $var
-bash: Algorithms: command not found
[3*2]
I feel it very strange it to declare;
$ var=$[3 * 2]; echo $var
6
Perform very likely from intuitive perception:
$ var=$6; echo $var
It's odd.
What's the mechanism which force the syntax should do it this way?
bash
New contributor
I am confused about the outer $
in var3=$[$var1 * $var2]
Suppose the following script:
$ var1=5; var2=6; var3=$[$var1 * $var2]; echo $var3
30
If $
is removed, it report error:
$ var1=5; var2=6; var3=[$var1 * $var2]; echo $var3
-bash: Algorithms: command not found
30
$ var=[3 * 2]; echo $var
-bash: Algorithms: command not found
[3*2]
I feel it very strange it to declare;
$ var=$[3 * 2]; echo $var
6
Perform very likely from intuitive perception:
$ var=$6; echo $var
It's odd.
What's the mechanism which force the syntax should do it this way?
bash
bash
New contributor
New contributor
New contributor
asked 2 mins ago
rider dragon
26526
26526
New contributor
New contributor
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
rider dragon is a new contributor. Be nice, and check out our Code of Conduct.
rider dragon is a new contributor. Be nice, and check out our Code of Conduct.
rider dragon is a new contributor. Be nice, and check out our Code of Conduct.
rider dragon is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f477876%2fvar-3-2-seem-conflict-with-intuitive-perception%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password