SHELL+IDL bridge. [message #92896] |
Fri, 18 March 2016 04:52  |
Sapna Mishra
Messages: 66 Registered: December 2015
|
Member |
|
|
Hello all,
I have a bash script , in which I want to read a file using IDL
IDL COM: ftab_print,'FORS1_B_GRS_600V_94_GG375_30.fits',[1,5,6],texto ut='tt.txt'
then I want to run these bash commands inside my script:
disp=( $(awk '{print $1}' ./tt.txt) )
start=( $(awk '{print $2}' ./tt.txt) )
end=( $(awk '{print $3}' ./tt.txt) )
Also I want to call IDL functions in this script. Anyone can help me out?
when I am running my script: bash script.bash
i get error:
% Syntax error.
bash: -c: line 0: unexpected EOF while looking for matching `)'
My all script:
#!/bin/bash
idl <<!here
.rnew CLASSIFICATION.pro
.rnew NEWFILE.pro
ftab_print,'FORS1_B_GRS_600V_94_GG375_30.fits',[1,5,6],texto ut='tt.txt'
spawn, 'disp=( $(awk '{print $1}' ./tt.txt) )'
spawn, 'start=( $(awk '{print $2}' ./tt.txt) )'
spawn, 'end=( $(awk '{print $3}' ./tt.txt) )'
spawn, 'esorex fors_science --dispersion=${disp[1]} --resp_fit_degree=2 --startwavelength=${start[1]} --endwavelength=${end[1]} sci.sof'
exit
|
|
|
Re: SHELL+IDL bridge. [message #92901 is a reply to message #92896] |
Fri, 18 March 2016 09:34  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Friday, March 18, 2016 at 7:52:49 AM UTC-4, Sapna Mishra wrote:
> Hello all,
>
> I have a bash script , in which I want to read a file using IDL
>
You have some serious issues, but they are mostly BASH related and mostly not related to IDL.
Issue 1: your !here document doesn't end
Issue 2: substitution is not working in the order you think it does. Instead of sending the script to IDL directly, send it to a file and see what comes out. You will be surprised what is missing.
Issue 3: your use of single quotes in the SPAWN statements are potential syntax errors. Within IDL you cannot embed single quotes within a single-quoted string like you did. This "string 'single'" is OK but 'string 'single'' is not.
Craig
|
|
|