How to expand only bash $variable at any certain point of anything (time, condition, etc) ? as this works :
i=1
u="sum = $i + \$o"
o=two; n=$(eval echo $u)
to equalize to n='sum = 1 + two'
the truth, $(eval echo $)
won't work for complex long expression
The real case the u above is some find arguments as, e.g., the output of set -x:
C='( -ipath /home/olive/build/CMakeFiles/* ( ( -type d ( -regex .*\s.* -printf '\''%p/'\''\n -o -printf %p/\n ) -o ( -regex .*\s.* -printf '\''%p'\''\n -o -printf %p\n ) ) ) -o -ipath /home/olive/build/CMakeFiles -type f ( -regex .*\s.* -printf '\''%p'\''\n -o -printf %p\n ) -o -iregex .{17}/.+/CMakeFiles$RP ( -type d ( -regex .*\s.* -printf '\''%p/'\''\n -o -printf %p/\n ) -o ( -regex .*\s.* -printf '\''%p'\''\n -o -printf %p\n ) ) )'
So $RP there is big need to be expanded after once expansion (like $o on sample)
So how to expand only a bash variable at any certain arbitrary point without touch any else expression in which the var. sit