Sqrt issue in bash
guillermo
-
lami20j Posted messages 21506 Registration date Status Moderator, Security Contributor Last intervention -
lami20j Posted messages 21506 Registration date Status Moderator, Security Contributor Last intervention -
Hello,
right now, I am working on a bash program and I need to calculate a square root.
For that, I am using the command sqrt:
to calculate the square root of the variable "$a" and store it in the variable "$rac", I do the following: $rac = sqrt($a)
But when I run the script, I get the following message:
./essai2.sh: line 14: Syntax error near unexpected token « ( »
./essai2.sh: line 14: '$rac = sqrt($a)'
Thank you in advance.
Configuration: Linux / Firefox 3.6.13
right now, I am working on a bash program and I need to calculate a square root.
For that, I am using the command sqrt:
to calculate the square root of the variable "$a" and store it in the variable "$rac", I do the following: $rac = sqrt($a)
But when I run the script, I get the following message:
./essai2.sh: line 14: Syntax error near unexpected token « ( »
./essai2.sh: line 14: '$rac = sqrt($a)'
Thank you in advance.
Configuration: Linux / Firefox 3.6.13
A variable in bash is declared without the "$" sign (dollar) and without spaces before or after the "=" sign (equal) ;-((
@zipe31
It reminds me of a message ;-)