Welcome to iraf.net Friday, May 17 2024 @ 04:14 AM GMT
FSBoyden |
05/10/2007 09:42AM (Read 4335 times)
|
|
|
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
|
|
|
|
fitz |
05/10/2007 09:42AM
|
|
|
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
|
|
|
|
| |
|
Content generated in: 0.07 seconds |
|