I'm very confused about what is wrong with the bash variable ${fwhm}
in this code. The script CRNitschke.py
returns 3 floating point numbers which I need to have for use in this bash script:
fwhm_dt_ft=(`/u/ki/awright/thiswork/eyes/CRNitschke/CRNitschke.py ${file}`)
fwhm=${fwhm_dt_ft[0]}
dt=${fwhm_dt_ft[1]}
ft=${fwhm_dt_ft[2]}
after I run this, everything in bash looks normal:
~$ echo "fwhm= " ${fwhm}
fwhm= 0.52
~$ echo "dt= " ${dt}
dt= 139.960346726
~$ echo "ft= " ${ft}
ft= 15.2307051015
except when I have these as inputs elsewhere there are problems. For example for the python script print_args.py
given by:
#! /usr/bin/env python
import sys
print "sys.argv=",sys.argv
I get wierd looking things like this:
~$ ./print_argv.py ${fwhm} ${dt} ${ft}
sys.argv= ['./print_argv.py', '\x1b[?1034h0.52', '139.960346726', '15.2307051015']
does anyone know what could be up with the fwhm
variable or how I could fix it?
It's strange because when I just type things in it's fine:
~$ abc=(0.52 139.960346726 15.2307051015)
~$ ./print_argv.py ${abc[0]} ${abc[1]} ${abc[2]}
sys.argv= ['./print_argv.py', '0.52', '139.960346726', '15.2307051015']
-Adam
NEXT DAY UPDATE: ... OK, here is a little added info. I ran this command in a script rather than at the command line and the output showed this:
+ echo 'fwhm= ' '0.58'
fwhm= 0.58
+ echo 'dt= ' 114.988365258
dt= 114.988365258
+ echo 'ft= ' 12.190067533
ft= 12.190067533
you can see that in the echo
line, the numerical value of fwhm
is in quotes and that is not the case for dt
and ft
. I have no idea why this would be the case, since python prints everything out the same. Any help would be appreciated!