Welcome to iraf.net Wednesday, April 24 2024 @ 08:17 AM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 how to indroduce int variable defined in script to a foriegn command
   
prajwel
 04/12/2014 08:10AM (Read 1595 times)  
+----
Newbie
gloomy

Status: offline


Registered: 02/24/2014
Posts: 7
I'm having a hard time introducing an integer which I have defined in script to a simple "sed" command Confused Frown

I have declared variable in script like this

PHP Formatted Code
int F=0
 

Now I put this in a while loop and get a particular value assigned to it. To know which file name this value corresponds to, I use this command

PHP Formatted Code
!sed 'Fq;d' flats


where F is the integer and flats is a list of flat images.

Please help me out on this Rolling Eyes Sick Surprised!

 
Profile Email
 Quote
fitz
 04/12/2014 04:02PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040

What you're trying to do is mix literal strings and script variables, which you can do, but you have to create a new command string and then use the CL to execute it. For example,

PHP Formatted Code
print ("!sed '" // F // "q;d' flats") | cl()


where the '//' is the string concatenation operator and the value of the F variable is put into the string.

If all you're doing is looping over the contents of the 'flats' file, the CL way to do this is

PHP Formatted Code

list = "flats"
while (fscan (list, s1) != EOF) {
    ... do something withe 's1' variable that contains the next line of the file
}
 


For more on scripting see the guide at https://iraf.net/irafdocs/script/




 
Profile Email
 Quote
   
Content generated in: 0.17 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