Welcome to iraf.net Friday, May 17 2024 @ 04:14 AM GMT


 Forum Index > Help Desk > Systems New Topic Post Reply
 Wildcards and if statements
   
FSBoyden
 05/10/2007 09:42AM (Read 4335 times)  
++++-
Regular Member

Status: offline


Registered: 06/07/2006
Posts: 95
HiI compiled scripts for different tasks. When I run the tasks, I want to check if the specific file is accessible. Thus created a list of image names, and then add different extentions to them, to see if they are there?Thus.imagenames -> imglistfscanf (imglist, img)if (access (img // "fit") || access (img // "mag"))
do somethingThe question that I would like to ask is how would I implement a wildcard?i.e.
if (access(img // "fit*"))
or
if (access(img // "fit" // *))Thanx
Pat

 
Profile Email
 Quote
fitz
 05/10/2007 09:42AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Hi Pat,The imaccess() function is what you should be using to check whether an image can be opened (doesn't require the extension), be neither the access() or imaccess() function can accept a file list or wildcard. To implement that you would need to probably use SECTIONS or FILES to expand the wildcard, pipe it to the COUNT task and then scan into a variable to look for a non-zero value, e.g.[code:1:ddd6863256]
sections ("img*.fits") | count STDIN | scan (nimages)
if (nimages > 0) {
.....
}orsections ("img*.fits", >& "dev$null)
if (sections.nimages > 0) {
....
}
[/code:1:ddd6863256]You can likewise just check the list of a file list. Note also that for images, the SECTIONS task has a 'nimages' parameter you can check directly.Cheers,
-Mike

 
Profile Email
 Quote
   
Content generated in: 0.07 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login