Submit a Story  :  IRAF Links  :  Past Polls  :  Calendar  :  Advanced Search  
     iraf.net
FAQ
 Forum FAQForum FAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

script command

 
Post new topic   Reply to topic    iraf.net Forum Index -> Systems
View previous topic :: View next topic  
Author Message
kwkchan



Joined: 02 Oct 2009
Posts: 12

PostPosted: Sun Dec 06, 2009 3:50 am    Post subject: script command Reply with quote

Hi! I have another question, in my script I am inputing a file and I want to include a command so that my script will do a certain thing if the input file is a .txt file and do something else if the input file is a .fit file. Does anyone know what the command is?
Back to top
View user's profile Send private message
fitz
Site Admin


Joined: 30 Sep 2005
Posts: 3255
Location: Tucson

PostPosted: Sun Dec 06, 2009 4:26 am    Post subject: Reply with quote

You can use something like

Code:

fname = "foo.fit"
len = strlen (fname)
extn = substr (fname, len-2, len)
if (extn == "fit") {
    ....something
} else if (extn == "txt") {
    ....something else
}


Another way to handle it is just to have separate parameters for images and text files and key off of whether the parameter is set.

-Mike
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    iraf.net Forum Index -> Systems All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2009 phpBB Group
 Copyright © 2005-2011 iraf.net
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.11 seconds