Hum, a bit ambiguous. It doesn't really sound like a loop but an
if (found in skiptable) { aline and stop }
elseif (found in sometable) { aline and do stuff }
I don't know whether or not you need the :skip and :end goto points - and the structure this code is embedded into.
- You can /return inside an alias. If the current alias was called by another alias, the current alias is not processed any further, BUT the alias/event that called the current alias will keep running.
- If instead you /halt inside the alias, the curent alias AND the alias/event that called the current alias won't be processed any furhter.
- If your alias was not called by another alias/event, or if there would be no further code in that alias/event, and if there would be no further code after your :end goto point, a if-else construction (without "stopping" commands) would suffice.
Assuming that the :skip and :end goto points are required, you could do e.g.
:skip
if ($hfind(skip,%name,1,W)) {
; if window "@window" doesn't exist so far, create it
window -zk0 @window
; aline the match to this window
aline -p @window $timestamp skipped %name ....
; break out of the current alias (don't process code after :end)
return or halt
}
elseif ($hfind(sometable,%name,1,W)) {
; if window "@window" doesn't exist so far, create it
window -zk0 @window
; aline the match to this window
aline -p @window $timestamp found %name ....
; do other stuff
some commands here
}
:end
; whatever follows here won't be executed if the first hfind was successful
; if you don't use this goto point, you can as well put the code into the elseif-part...
(Hope I got you right)