I’ve wanted IDL batch files to be executable scripts for awhile, but figured I would just have to live without that since IDL’s comment character is not #
. But then found out that Scheme also uses the ;
as the comment characters, but allows the first line to begin with #!
(the shebang) and just ignores that line. So I made rIDL mimic that:
$ mg_shebang_test.pro
This is an executable rIDL script!
where the mg_shebang_test.pro
script is:
#!/usr/bin/env ridl -quiet
; This is an example of an executable rIDL script that recognizes the shebang
; characters, #!, on the first line of the script.
print, 'This is an executable rIDL script!'
exit
This was actually quite simple to add to rIDL; I would love to see this feature in regular command line IDL.
January 23rd, 2013 at 11:46 am
Here’s something that may work… create a file called
stripfirst
with this content:Make it executable. And now your script should be like this:
This should strip the first line from the script and pass the rest to IDL.
January 23rd, 2013 at 11:49 am
Ops… I tested my solution here with Ferret (which uses
!
for comments) and while it works it hangs when the program is finished.January 24th, 2013 at 11:59 am
[…] the theme of Mike Galloy’s post yesterday, I’d like to show an example of noninteractive batch processing with IDL. The […]