Re: Capturing screen output [message #28121 is a reply to message #28086] |
Mon, 26 November 2001 09:54   |
David Shadovitz
Messages: 19 Registered: September 2000
|
Junior Member |
|
|
Liam,
Thanks for that. But I cannot even get that far! If I just make a simple
file containing IDL commands, it runs fine unless I try to redirect its
output. When I redirect its output, the output file is empty. Here's what I
mean:
$ cat runidl
print, 'Hello world'
exit
$ idl runidl
IDL Version 5.4 (sunos sparc). (c) 2000, Research Systems, Inc.
Hello world
$ idl runidl > runidl.out
IDL Version 5.4 (sunos sparc). (c) 2000, Research Systems, Inc.
$ cat runidl.out
$
Any ideas?
-David
"Liam E. Gumley" wrote:
> David Shadovitz wrote:
>>
>> I'm running IDL 5.4 on a Sun.
>>
>> I've got a file, cpsub1, which looks like this:
>>
>> $ cat cpsub1
>> echo "computePPP, /batch, inputfile='abc.hdf'" | idl
>>
>> If I run it by simply typing cpsub1 at the command line, all of the IDL
>> messages and PRINT statement outputs are sent to the screen:
>>
>> $ cpsub1
>> % Compiled module: MODULE1
>> % Compiled module: MODULE2
>> % Compiled module: MODULE3
>> Entered main routine...
>> Computing the power...
>> Done.
>> $
>>
>> I'd like to capture that information in a log file, so I tried
>> redirecting standard output, like this:
>>
>> $ cat cpsub2
>> echo "computePPP, /batch, inputfile='abc.hdf'" | idl > cplog2
>>
>> $ cpsub2
>> % Compiled module: MODULE1
>> % Compiled module: MODULE2
>> % Compiled module: MODULE3
>> $
>>
>> As you can see, now only the IDL messages are written to the screen.
>> But the PRINT statement outputs aren't sent to the log file! Upon
>> completion, cplog2 is a 0-byte file.
>>
>> Then I tried redirecting both standard output and standard error:
>>
>> $ cat cpsub3
>> echo "computePPP, /batch, inputfile='abc.hdf'" | idl > cplog3 2>&1
>> $ cpsub3
>> $
>>
>> Now nothing is written to the screen. But neither is it going to the
>> log file! Upon completion, cplog3 is a 0-byte file.
>>
>> Can anyone help me capture the IDL messages and the PRINT statement
>> output into a file? I'm running my code in this odd manner because
>> ultimately I want to run the job in batch mode via 'ssub'.
>
> David,
>
> The following method works for me (I normally use the C shell):
>
> #---cut here---
> #!/bin/csh -f
>
> # Sample script to execute IDL in batch mode
>
> # Create IDL run script
> echo "print, 'Hello world'" > runidl
> echo "exit" >> runidl
>
> # Run IDL
> /usr/local/bin/idl runidl >& runidl.out
> #---cut here---
>
> You may need to adjust the last line if IDL is installed in a
> non-default directory.
>
> Cheers,
> Liam.
> Practical IDL Programming
> http://www.gumley.com/
|
|
|