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 
Return to the default flat view Create a new topic Submit Reply
Re: spawn and 'ls *.out' [message #50276 is a reply to message #50275] Wed, 20 September 2006 01:16 Go to previous messageGo 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
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Redraw an image in IDL object
Next Topic: Maddening structures

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

Current Time: Sun Oct 12 19:51:45 PDT 2025

Total time taken to generate the page: 1.68141 seconds