send " ' " (single quote character) via system command?
Bruce Easton
bruce at stn.com
Mon Dec 8 07:47:11 PST 2014
I'm glad that you've found a solution. I don't show a reply on this
issue from Jim Asman, so I'm assuming his reply was off-list. So for
the sake of others reading this thread, I'll stress again that, for the
example given, no backslashing was needed to start with - and no need to
express the single quote as chr(39). All that was needed was to use the
single quote "as-is". To me, that also makes it easier to understand if
I had to come back to such code years later.
On 12/8/14, 9:58 AM, James Flanagan wrote:
> I want to thank everybody for chiming in their suggestions.
>
> It turns out that Jim Asman’s suggestion:
>
> Try using chr(39) rather than \' and see if you get any further.
>
> was exactly what I needed to make my code work properly. for those
> who suggested putting the code into an external script, my preference
> is to keep the code within filepro whenever possible for debugging
> purposes.
>
>
> IN ADDITION,
>
> thank you for pointing out the unnecessary use of cat in my code.
> Some 15 years ago, one of my first unix instructors taught me that
> method of using sed (stream editor) that you first needed to put
> something in the stream (using something such as cat). for as many
> times as i have been in the man pages of sed, I never noticed that sed
> can exists as a stand alone command. old habits die hard, but i
> assure you i will not be repeating that one going forward.
>
> James Flanagan
> Flantec.com <http://Flantec.com/>
>
> email:James at Flantec.com <mailto:James at Flantec.com>
> mobile:760-458-8498
> home:219-221-6219
> text:7604588498 at txt.att.net <mailto:7604588498 at txt.att.net>
>
> aim:Flantec
> oovoo:Flantec
> Skype:Flantec
> ichat:Flantec at mac.com <mailto:Flantec at mac.com>
>
> home:1901 Cidermill Road
> Michigan City, IN 46360
>
>> On Dec 6, 2014, at 10:42 PM, Bruce Easton <bruce at stn.com
>> <mailto:bruce at stn.com>> wrote:
>>
>> On 12/6/14, 5:38 PM, James Flanagan wrote:
>>> ok, I may have accidentally not included all the code to make myself
>>> clear. my apologies.
>>>
>>> ::html_file="/www/"{5{"/"{1{".html":
>>> :exists(html_file) eq "0":unix="cat /www/template.html | sed
>>> \'s/XXXXX/"{1{"/g\' >"<html_file:
>>> ::msgbox unix:
>>> :exists(html_file) eq "0":system noredraw unix:
>>>
>>>
>>> The msgbox command is just there for troubleshooting. when i test
>>> it, I get the following in the msgbox:
>>>
>>> cat /www/template.html | sed 's/XXXXX/wcpc1/g' > /www/wcc/wcpc1.html
>>>
>>> Copying and pasting the output of the msgbox does work properly to
>>> achieve the intended goal. however, the command when run from the
>>> system command, results in an empty destination file. that tells me
>>> that system command is processing the command all the way to the
>>> end, and is getting tripped up on the single quote (or possibly the
>>> pipe) somewhere in the middle.
>>>
>>> so my question again is there a way to send such a command and have
>>> the filepro system command pass it to the system properly?
>> [..]
>>
>> Removing the unnecessary backslashes before the single quotes should
>> make your code work as expected, James. (Note this difference
>> between your code and Ken's example. If you don't get any output at
>> all after that change, then you might need to look at permissions for
>> your output destination. But since you said "empty destination", I'm
>> assuming it created the file and therefore the perms is not an issue.
>> Another thing to check if you're not getting any output is if you've
>> possibly declared "html_file" and/or "unix" for lengths that are
>> insufficient [since I don't see their declaration here].)
>>
>> Also, as Bill and Ken pointed out, the use of cat is unnecessary
>> since sed just needs to be told where to get its input. Therefore,
>> simplify with:
>>
>> unix="sed 's/XXXXX/"{1{"/g' </www/template.html >"{html_file
>>
>> as Ken pointed out.
>>
>> Bruce
>>
>> _______________________________________________
>> Filepro-list mailing list
>> Filepro-list at lists.celestial.com
>> <mailto:Filepro-list at lists.celestial.com>
>> Subscribe/Unsubscribe/Subscription Changes
>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20141208/e060c171/attachment.html>
More information about the Filepro-list
mailing list