whats wrng with the following
max_opt=$(expr ${std_cnt} + ${alt_cnt})
it says expr : syntax error
pls help,its urgent
whats wrng with the following
max_opt=$(expr ${std_cnt} + ${alt_cnt})
it says expr : syntax error
pls help,its urgent
Hi,
before this line you must have to define some value for the variables
std_cnt and alt_cnt. It show this error, if any one is missed.
please check it,
Ex:
------------------------------
std_cnt=5;
alt_cnt=5;
max_opt=$(expr ${std_cnt} + ${alt_cnt})
echo $max_opt
----------------------------------
it will give the o/p: 10
Place the following in the first line of the script:
#!/bin/ksh
Presumably, you tried to perform integer arithmetic on variables that do not contain integers.
If they contain numbers with decimal fractions, use a tool that can process fractions; expr doesn't.
If you can use KornShell93, try:
max_opt=$(( $std_cnt + $alt_cnt ))
Otherwise:
max_opt=$( awk "{ print $std_cnt + $alt_cnt }" )