Does the code look like this?
case "$5" in
-|+) eval '(('jd2=${jd1}${5}${6}'))' jd2date $jd2
esac
If so, you might call the command like so:
script arg1 arg2 arg3 arg4 + 6
or
script arg1 arg2 arg3 arg4 - 10
You may be able to make the code look like this:
eval '(('jd2=${jd1}+${5}'))' jd2date $jd2
The command would be called like so:
script arg1 arg2 arg3 arg4 10
${5}
, ${6}
, ${jd1}
, and $jd2
are substituted with the contents of their
respective variables. Variables that are numbers (e.g. $5
and $6
) are positional
parameters.
Since you no longer need the operator to be placed by a variable, the call to
eval
is not necessary. Your code may look like this:
(( jd2=${jd1}+${5} ))
jd2date $jd2
Or, with slightly cleaner syntax:
(( jd2 = jd1 + $5 ))
jd2date $jd2
$jd2
?