comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Passing Batch File Names
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Passing Batch File Names [message #62365 is a reply to message #62281] Wed, 03 September 2008 12:18 Go to previous message
Trae is currently offline  Trae
Messages: 23
Registered: May 2007
Junior Member
> Your solution is very handy, but one should point out that blind execution of commands
> read from a file is potentially dangerous. It's probably not that big of an issue for IDL,
> but some of those batch file lines could be something like,

Oh yeah. I would never do this in perl or anything that had write
permissions in critical areas. The batch files made would be few in
number and only made a handful of people.

Still, it just became easier to change the structure of the previously
written codes then to deal with all of the issues, this being a big
one, that came about by trying to use batch files.

Good comment.

-Trae



On Sep 2, 2:16 pm, Paul van Delst <Paul.vanDe...@noaa.gov> wrote:
> Trae wrote:
>> Just in case another poor soul needs this and searches the group, here
>> are the lines of code that made it work. NB: EXECUTE only accepts
>> scalars as an input. Bogus.
>
> Your solution is very handy, but one should point out that blind execution of commands
> read from a file is potentially dangerous. It's probably not that big of an issue for IDL,
> but some of those batch file lines could be something like,
>
> stuff = file_search('*')
> for i=0,n_elements(stuff)-1 do file_delete, stuff[i], /quiet,/recursive
>
> Keep those batch files protected from disgruntled employees. :o)
>
> Using exec capabilities blindly is generally discouraged in scripting languages.
>
> cheers,
>
> paulv
>
>
>
>> First define a batch file named batch_test.pro with the commands
>
>> a=5
>> b=6
>> c=sin(!dpi/4.)
>
>> Now here are the commands to read and execute it.
>
>> file='batch_test.pro'
>
>> openr, lun, file, /GET_LUN
>> var_arr=''
>> ;while not eof do begin
>
>> WHILE ~ EOF(lun) DO BEGIN
>> line=''
>> READF,lun , line
>> var_arr=[var_arr,line]
>> ENDWHILE
>> FREE_LUN, lun
>> var_arr=var_arr[1:*]
>
>> for i=0ul,n_elements( var_arr) -1ul do result=execute(var_arr[i])
>
>> END
>
>> So you can define the variable 'file' anyway you want and it can have
>> as many or as few commands as you need.
>
>> Thanks for the help everyone!
>
>> I'm off to be quite pleased with myself for awhile! :)
>
>> Cheers,
>> -Trae
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Singular Value Decomposition in 3 Dimensions
Next Topic: FFT and ROTATE

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:33:39 PDT 2025

Total time taken to generate the page: 0.80133 seconds