I am comparing two strings using the levenshtein distance
algorithm. I got the PHP implementation of the algorithm from here. I am calling this php implementation from my shell script as below.
levenshtein_return=$(php levensh.php "String1" "String2")
The levenshtein_return
variable contains the value as 1 now as there is a single character difference.
Now, before inserting the value as such in database tables, I need to perform some arithmetic operations using this variable. I am trying to implement as,
table_value=$( expr( 1/ ( 1 + $levenshtein_return ) ) )
However, if I use the above syntax I am getting an error as,
line 52: syntax error near unexpected token `1'
How can I change the expr statement so that I can get the actual value for the table_value
variable?
Best Answer
You shouldn't use
expr
in this case, try this: