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

Home » Public Forums » archive » Re: spawn and 'ls *.out'
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: spawn and 'ls *.out' [message #50275] Wed, 20 September 2006 02:23
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
>> On Tue, 19 Sep 2006, queiny98@yahoo.com wrote:
>>
>>> Dear IDL experts,
>>>
>>> Can I use '*' and '?' in the UNIX commands through 'spawn'?
>>>
[...]

I would suggest to use file_search instead, it supports
wildcards characters.

Ciao,
Paolo
Re: spawn and 'ls *.out' [message #50276 is a reply to message #50275] Wed, 20 September 2006 01:16 Go to previous message
Allan Whiteford is currently offline  Allan Whiteford
Messages: 117
Registered: June 2006
Senior Member
F�LDY Lajos wrote:
>
> On Tue, 19 Sep 2006, queiny98@yahoo.com wrote:
>
>> Dear IDL experts,
>>
>> Can I use '*' and '?' in the UNIX commands through 'spawn'?
>>
>> When I try:
>>
>>> spawn, ['ls', 'data/2003????'], /noshell
>>
>> Cannot access data/2003????: No such file or directory
>>
>> I have files like '20030101', '20030102', etc. in this directory.
>> It seems 'spawn' interpolate '?' directly or literally. How could I let
>> IDL know?
>>
>> Thanks.
>>
>
> * and ? are evaluated by the shell. ls (and any other program) gets real
> filenames. Omit the /noshell keyword.
>
> regards,
> lajos
>

Also, note than when you remove the /noshell your command becomes more like:

spawn,'ls data/2003????'

Be careful though that the user hasn't alias 'ls' to do something else,
it can sometimes be safer to do:

spawn,'\ls data/2003????'

the '\ls' is a standard unix feature which ignores any aliases. Of
course, some idiot could have replaced their ls binary but that's less
likely than having an alias present. Lots of modern linux distributions
have built in --color etc, I personally have: 'ls -h --color -F'. If
you're going to capture the output via something like:

spawn,'\ls data/2003????',output

then you really don't want all the colour codes in amongst things.

Thanks,

Allan
Re: spawn and 'ls *.out' [message #50282 is a reply to message #50276] Tue, 19 September 2006 14:59 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Tue, 19 Sep 2006, queiny98@yahoo.com wrote:

> Dear IDL experts,
>
> Can I use '*' and '?' in the UNIX commands through 'spawn'?
>
> When I try:
>
>> spawn, ['ls', 'data/2003????'], /noshell
> Cannot access data/2003????: No such file or directory
>
> I have files like '20030101', '20030102', etc. in this directory.
> It seems 'spawn' interpolate '?' directly or literally. How could I let
> IDL know?
>
> Thanks.
>

* and ? are evaluated by the shell. ls (and any other program) gets real
filenames. Omit the /noshell keyword.

regards,
lajos
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Redraw an image in IDL object
Next Topic: Maddening structures

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

Current Time: Wed Oct 08 15:26:56 PDT 2025

Total time taken to generate the page: 0.00569 seconds