Welcome to iraf.net Tuesday, May 07 2024 @ 02:50 AM GMT
Jason Quinn |
04/28/2008 06:48PM (Read 2243 times)
|
|
|
Status: offline
Registered: 04/07/2006
Posts: 175
|
The [b:ef1273d2f6]mkscript[/b:ef1273d2f6] task always assumes by default that the user wants to add another task despite having a "more" parameter that the user can set. The relevant portion of code is[code:1:ef1273d2f6]
# Ask if more commands are to be added to the script.
more = YES
if (!more)
break
[/code:1:ef1273d2f6]I think deleting the "more=YES" line restores proper behavior. I couldn't think of a reason why it might have been hard-coded to YES on purpose.Jason
|
|
|
|
valdes |
04/28/2008 06:48PM
|
|
|
Status: offline
Registered: 11/11/2005
Posts: 728
|
You almost got me on that one when I took the statement out and then realized the reason. The reason it is there is to reset the default for the query parameter before the parameter is referenced, which results in a user query. So in a loop, if the value was "no" from a previous run, the user will get the prompt
[code:1:285b5de2c8]
Add another command? (yes):
[/code:1:285b5de2c8]So this is actually a correct bit of IRAF code though mighty musty (1986).Frank
|
|
|
|
Jason Quinn |
04/28/2008 06:48PM
|
|
|
Status: offline
Registered: 04/07/2006
Posts: 175
|
[quote:296a47e9db="valdes"]You almost got me on that one when I took the statement out and then realized the reason. The reason it is there is to reset the default for the query parameter before the parameter is referenced, which results in a user query. So in a loop, if the value was "no" from a previous run, the user will get the prompt[/quote:296a47e9db]For me the task always prompts for the "more" parameter regardless if the "more=YES" line is commented or uncommented (the only exception is if a "more=yes" or "more=no" is explicitly given on the command line). The user [i:296a47e9db]always[/i:296a47e9db] gets a query. It's just a matter if the very first prompt's default answer will be "no" from the previous run, which from my perspective is the lesser of two evils because we gain the proper behavior when the task's "more" parameter is set by epar. Personally, I think this trumps having the task always assume the user wants to add more tasks. I suppose this is somewhat a matter of taste. I tend not to add more than one task in [b:296a47e9db]mkscript[/b:296a47e9db] because I build my longer scripts up one at a time in a proper text editor; so having the task remember "no" from the last run is nice because I probably don't want to add more tasks. Without the "more=YES" line, if I do happen to say "yes" the task then "adapts" by assuming I want to add more. In summary, I don't think it's such a bad thing if the task prompts with[code:1:296a47e9db]
Add another command? (no):
[/code:1:296a47e9db]Hopefully I understood your post correctly. I was a little uncertain what the "so in a loop" part meant. Did you mean actually command line loops like [i:296a47e9db]for[/i:296a47e9db] and [i:296a47e9db]while[/i:296a47e9db] or script loops? Do you know if people use [b:296a47e9db]mkscript[/b:296a47e9db] within those?Cheers,
Jason
|
|
|
|
| |
|
Content generated in: 0.09 seconds |
|