Re: Multiple Spawn Commands [message #49387 is a reply to message #49294] |
Sat, 15 July 2006 07:22   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
"Ryan." <rchughes@brutus.uwaterloo.ca> writes:
> Dear IDL Gurus,
>
> Is it possible to issue multiple Spawn commands in Unix IDL without
> closing the shell? What I want to do is issue a very simple foreach
> loop but i cannot call spawn long enough to input all the commands. I
> think i might have to use the Unit keyword of spawn but i'm not sure
> how it works. Due to the simplicity of what I want to do I might be
> able to do it in fewer commands in Unix but I don't have enough
> experience in Unix to know how. Any help would be greatly appreciated.
I agree with you that this can't be done with semicolons as the other
posters suggested.
> I want the following commands issued in Unix:
> change to desired directory
> foreach i ( file1 file2 file3 ... )
> ...file_dump.pl -$i ...
> end
>
> To do this I have the following:
> spawn, foreachcommand
> spawn, filedumpcommand
> spawn, endcommand
I have to ask, why are you trying to directly transliterate a c-shell
script? You're in IDL, why not use it?
files = ['file1', 'file2', 'file3', '...']
for i = 0, n_elements(files)-1 do begin
cmd = string(files[i], format='("...file_dump.pl -",A0," ... "))
spawn, cmd
end
Or, you could make a single shell script with all the commands you
want to run, give the file executable permissions, and then run it
with a single command from IDL.
Good luck!
Criag
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|