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

Bruce Easton bruce at stn.com
Thu Feb 13 12:52:12 PST 2014


On 2/13/14 3:30 PM, Kenneth Brody wrote:
> On 2/13/2014 12:45 PM, James Flanagan wrote:
>> [...]
> [...]
>
> filePro currently requires that the command be specified on the USER line,
> and doesn't take any variables.
>
> You could pass the variable to the program.  Using your example:
>
>       user prog = /flantec/scripts/findphoto
>       prog = qx      ' Pass the filename to the script
>       result = prog  ' Get the result back
>
> Then, the script would then read the name from stdin, rather than the
> command line.
>
>       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).  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.

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.

Bruce




More information about the Filepro-list mailing list