USER (was Re: exists or similar command to work like grep on file system files)

Kenneth Brody kenbrody at spamcop.net
Thu Feb 13 13:33:40 PST 2014


On 2/13/2014 3:52 PM, Bruce Easton wrote:
> On 2/13/14 3:30 PM, Kenneth Brody wrote:
[...]
>>        while read name
>>        do
>>            # The "real work" goes here.
>>        done
>>
> Ken, that technique for the script worked fine for me for one iteration
> from the processing table.  I don't know if it's that, in my example, I
> was repeating the call within @menu or something else, but when I tried
> repeating the "call" to the user program by start back at @menu (or even
> just below the user command), it would fail on the first repetition
> (using a while loop like you show here).

What do you mean by "fail"?

>  By a lucky guess, removing the
> while loop in the script to simply be:
>
> read pattern
> ls -1
>
> and putting a "close [userprogname]" before cycling around to @menu
>
> enabled it to work repetitively.  It was the first time I've tried a
> close for the user command label.

You could also do it "the right way" :-) with:

     while read pattern
     do
         ls -1
         echo "**END**"
     done

(You need some way for your processing to know that it reached the end of 
the output list.  Hence the echo.)

> The only other times I've used the user command was on Unix using the
> method you described, but I know for certain those instances were not
> part of @menu. These recent tests have been on 5.0.14 on RH Linux.

Putting it in @MENU should have no effect on how it works.

-- 
Kenneth Brody


More information about the Filepro-list mailing list