help with syntax...filepro 5.0.13 OSR 5.0.7

Enrique Arredondo henry at vegena.net
Fri Jan 20 10:59:30 PST 2006


----- Original Message ----- 
From: "Brian K. White" <brian at aljex.com>
To: <filepro-list at lists.celestial.com>
Sent: Thursday, January 19, 2006 6:28 PM
Subject: Re: help with syntax...filepro 5.0.13 OSR 5.0.7


>
> ----- Original Message ----- 
> From: "Enrique Arredondo" <henry at vegena.net>
> To: <filepro-list at lists.celestial.com>
> Sent: Thursday, January 19, 2006 8:09 PM
> Subject: help with syntax...filepro 5.0.13 OSR 5.0.7
>
>
>> I'm trying to generate a file that will make hundreds of symbolic links 
>> but I'm missing the right combination of  's and  `s  within the system 
>> noredraw command.
>>
>> here's where the magic takes place :
>>
>> Then: system noredraw "umask 0;cd /vegedoc;FI=`find . -name"<imp(4){".pd
>>
>> f -print`;echo 'ln -s $FI"<dd{"' >> /usr2/tmp/foundit"
>>
>> the outfile being created looks like this :
>>
>> ln -s $FI 
>> /vegedoc/CoreCenter/AMC/AMC-150/1---A22-EnsambleDeMotor/E-150-A22.pdf
>>
>> The $FI becomes not a variable when you put in between 's but if I don't 
>> put the 's the system tries to execute a ln command.
>>
>> if I replace the echo part with " ; echo $FI >> /usr2/tmp/foundit"
>>
>> I get the real value of $FI.
>>
>> Can you find the problem ??
>
>
> Sure, don't use single quotes. Escape the double quotes that you don't 
> want the system() command to see instead.
> Just use your existing line without changing anything but replace each ' 
> with \"
>
> system noredraw "umask 0;cd /vegedoc;FI=`find 
> . -name"<imp(4){".pdf -print`;echo \"ln -s $FI"<dd{"\" >> 
> /usr2/tmp/foundit"
>

Wow, It works now! thanks!

> Not that I'd do it that way.
>
> I'd just write ln commands to the file. No need to run find a zillion 
> times that I can see.
> No need to fill a variable (FI) and then use it that I can see either. If 
> there is more and the value is reused later that's different, but since 
> the value looks like it changes with every record that can't be the case 
> here. I'd probably write the file with file-io commands instead of "system 
> echo >> file" too.
>
> My system command would be:
> First one system command in @once or on the first record or otherwise 
> before the main loop, to create the file with the desired permissions 
> since fp provides no way to do it and doesnt respect the umask in effect 
> at the time p/runmenu/clerk/report was called either. And some other stuff 
> to set up the file-io command:
> Then: fn="/usr2/tmp/foundit"
> Then: system noredraw "umask 0;>"<fn
> Then: fh=open(fn,"wt")
> Then: x=writeline(fh,"cd /vegedoc")
>
> then this inside the loop
> Then: x=writeline(fh,"ln -s"<imp(4){".pdf"<dd)
>
> then this after the loop
> Then: x=close(fh)
>
> When you run foundit, any time the imp(4) wasn't found, ln just generates 
> an error and no link is created. you and add 2>/dev/null to the writeline 
> or better just add it to the end of the command that runs foundit.
>
> Or, if the harmless error messages really bother you, you can have fp see 
> if the file is there and not write a command sometimes by doing exactly 
> the same as above but only adding this "If: " to the writeline command 
> above
>
> this inside the loop
>  If: exists("/vegedoc/"{imp(4){".pdf") eq "1"
> Then: x=writeline(fh,"ln -s"<imp(4){".pdf"<dd)
>
> And since "/vegedoc" is used more than once I'd make that into a dummy too 
> and fill it once near the top or bottom of the table with other 
> "configuration settings" instead of burying it in multiple spots in the 
> code like that. Just asking for difficulty some day when you need to 
> change it or copy it for some new similar use.
>

Thanks for the new ideas, in this case filepro is importing imp(4) from a 
comma delimited file that's why I'm forced to do a find on hundreds of 
subdirectories and then dynamically assign a link to it. 



More information about the Filepro-list mailing list