libreadline undefined symbol: PC in bash when using | bc -l -


i connecting ssh machine execute bash script, problematic part following:

fkeypar "ex1.fef[1]" tstarti         #### fkeypar external command values assign subsequent variables t0i="$(expr $(pget fkeypar value) - 11544)"                                           fkeypar "ex1lc.fits[2]" telapse lengthini=`pget fkeypar value` fkeypar "ex7lc.fits[2]" tstop lengthfin=`pget fkeypar value` fkeypar "ex1lc.fits[2]" tstart       ijd=`pget fkeypar value`  i=$(echo "($ijd - $t0i) / $period + 1" | bc -l | sed 's/\..*//') ifin=$(echo "($lengthfin - $ijd)/$period + 1" | bc -l | sed 's/\..*//') echo "($ijd - $t0i) / $period + 1" | bc  ((n=$i; n<=$ifin; n++))    ... 

this returns following errors:

bc: symbol lookup error: /science/heasoft-6.14/x86_64-unknown-linux-gnu-libc2.9/lib/libreadline.so.6: undefined symbol: pc bc: symbol lookup error: /science/heasoft-6.14/x86_64-unknown-linux-gnu-libc2.9/lib/libreadline.so.6: undefined symbol: pc bc: symbol lookup error: /science/heasoft-6.14/x86_64-unknown-linux-gnu-libc2.9/lib/libreadline.so.6: undefined symbol: pc ./script: line 39: ((: n=: syntax error: operand expected (error token "=") 

googling lot, found related these "bugs": https://science.nrao.edu/forums/viewtopic.php?f=44&t=75

https://bugzilla.redhat.com/show_bug.cgi?id=162023

https://dba.stackexchange.com/questions/31143/libreadline-so-6

i don't have idea on how fix it, without trying random things. appreciated.

edit: forgot mention that, in many trials, ssh-ing many times, managed somehow not error , run script, same syntax reported in question. @ moment, thought syntax problem, error appeared again @ consequent ssh-ings.

edit2: doesn't matter version of heasoft load, error appears heasoft-6.14 version. think related possible fix.

most of problem can't -- administrative rights recompile bc (or, better, knows why you're not doing sane thing , using os-vendor-provided version) need fix it. (this may simple renaming bc under /science/heasoft-6.14 out of way, , allowing vendor-provided implementation in path used instead).

that said, if you're doing integer math, there's no reason script use bc @ all:

i=$(( (idj - t01) / period + 1 )) ifin=$(( ( lengthfin - ijd ) / period + 1 )) echo "$(( ( ijd - t01 ) / period + 1 ))" 

the error have on line 39 consequence of these bugs in bc -- script expects i contain number, it's empty string, n=$i can't evaluate "$i" number, fails. in math context (which double parenthesis create), i evaluates 0 if variable undefined, $i causes error in same scenario; of these use depends on desired behavior. if want error when variable undefined, use $varname inside of (( )); if want script continue value of 0, use bare varname.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -