He escrito un programa en IDL para generar gráficos de dispersión basados en argumentos de línea de comando. Puedo llamar con éxito el programa directamente en el terminal de la siguiente manera:Ejecutando el programa IDL desde bash con variables
idl -e "scatterplot_1_2d_file.pro" $infile $outfile $title $xtitle $ytitle $xmin $xmax $ymin $ymax $timescale
Donde $ * se refieren a algunas cadenas literales escribió en el problema es, pensé que sería capaz de simplemente escribir esa misma línea, poniendo. en nombres de variables en lugar de los literales, en un script bash, y generar un millón de diagramas de dispersión mientras estoy en pausa. Por desgracia, si lo hago de esa manera, me sale el error:
idl: -e option cannot be specified with batch files
Así que mi siguiente intento fue intentar escribir estos comandos en un archivo por lotes IDL que entonces había corrido.
Ese intento se parece a esto:
#!/bin/bash
indir=/path/to/indir/
outdir=/path/to/outdir/
files=`ls $indir`
batchfile=/path/to/tempbatchfile.pro
echo .r "/path/to/scatterplot_1_2d_file.pro" >> $batchfile
for file in $files
do
name=${file%\.*}
echo scatterplot_1_2d_file $indir$name.txt $outdir$name.jpg $name "Gauge Precipitation (mm)" "NMQ Precipitation (mm)" "*" "*" "*" "*" 2 >> $batchfile
done #done file
echo exit >> $batchfile
idl <<EOF
@/path/to/scatterplot_1_2d_file
EOF
rm $batchfile
No sé si la mayor parte de los errores que genera la escritura son relevantes, así que voy a publicar el inicio y voy a publicar el resto más tarde si lo necesita:
[foo]$ bash script_thing.sh
IDL Version 6.3 (linux x86 m32). (c) 2006, Research Systems, Inc.
Installation number: 91418.
Licensed for personal use by XXXXXXXXX only.
All other use is strictly prohibited.
PRO scatterplot_1_2d_file
^
% Programs can't be compiled from single statement mode.
At: /path/to/scatterplot_1_2d_file.pro, Line 1
% Attempt to subscript ARGS with <INT ( 1)> is out of range.
% Execution halted at: $MAIN$
% Attempt to subscript ARGS with <INT ( 2)> is out of range.
% Execution halted at: $MAIN$
% Attempt to subscript ARGS with <INT ( 3)> is out of range.
% Execution halted at: $MAIN$
% Attempt to subscript ARGS with <INT ( 4)> is out of range.
% Execution halted at: $MAIN$
% Attempt to subscript ARGS with <INT ( 5)> is out of range.
% Execution halted at: $MAIN$
% Attempt to subscript ARGS with <INT ( 6)> is out of range.
% Execution halted at: $MAIN$
% Attempt to subscript ARGS with <INT ( 7)> is out of range.
% Execution halted at: $MAIN$
% Attempt to subscript ARGS with <INT ( 8)> is out of range.
% Execution halted at: $MAIN$
% Attempt to subscript ARGS with <INT ( 9)> is out of range.
% Execution halted at: $MAIN$
no sé si estoy tratando de hacer algo que no se puede hacer, pero no lo parece. ¿Algún consejo?
Vas a tener que arreglar todos los [citar] (http: // mywiki. wooledge.org/Quotes) errores, y corrige el [manejo de nombres de archivos] (http://mywiki.wooledge.org/ParsingLs) antes de que podamos dar consejos específicos. Si estás atrapado después de eso, publica el nuevo error. – ormaaj