Re: Multiple Spawn Commands [message #49292] |
Fri, 14 July 2006 09:43  |
Ryan.
Messages: 77 Registered: March 2006
|
Member |
|
|
Jo,
Thank you for your response, that is going to make my life a lot easier
but i can't seem to get it work properly in a UNIX environment. How do
you write a foreach loop in a UNIX environment in one line? I have
experimented a bit with it but it keeps complaining to me about
misplace brackets, what is the proper syntax?
Thanks again,
Ryan.
|
|
|
|
Re: Multiple Spawn Commands [message #49377 is a reply to message #49292] |
Tue, 18 July 2006 04:04  |
Jo Klein
Messages: 54 Registered: January 2006
|
Member |
|
|
Hi Ryan,
I notice you've gone for the IDL loop option, which is probably more
portable, so just for the record: This is the way you can do it in a
UNIX environment if you're running bash or sh. I just checked the doc,
csh and tcsh do not allow the use of a semicolon to delimit commands. To
make my one line solution work, you would have to switch to a bash
environment before starting IDL, such as
> bash
> idl
Cheers,
Jo
|
|
|
Re: Multiple Spawn Commands [message #49389 is a reply to message #49292] |
Fri, 14 July 2006 11:27  |
Maarten Sneep
Messages: 2 Registered: February 2006
|
Junior Member |
|
|
In article <1152895388.545979.198960@75g2000cwc.googlegroups.com>,
"Ryan." <rchughes@brutus.uwaterloo.ca> wrote:
> Jo,
> Thank you for your response, that is going to make my life a lot easier
> but i can't seem to get it work properly in a UNIX environment. How do
> you write a foreach loop in a UNIX environment in one line? I have
> experimented a bit with it but it keeps complaining to me about
> misplace brackets, what is the proper syntax?
What is your shell:
spawn, "echo $SHELL"
should tell. Because of the syntax you use in your original post, I
think you're using a csh derivative. It has been a while, but I think
a foreach loop looks like:
spawn, "foreach i (item1 item2 item3); action $i; end"
An O'Reilly book on shells will help you here, but often it is easier,
and more portable, to perform the action in IDL.
If all fails:
for ii=0,n_elements(files)-1 do $
spawn, "file_dump.ps " + files[ii]
(yeah, I know, lots of overhead, not pretty, but at least it'll work.)
Maarten
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
|
|
|