send " ' " (single quote character) via system command?

Bruce Easton bruce at stn.com
Sat Dec 6 20:42:33 PST 2014


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



More information about the Filepro-list mailing list