Problem is STR1 may contain a "'", then echo will not know where the string ends, hence the need to escape it.
----- Original Message ---- From: Mats Carlid <[EMAIL PROTECTED]> To: [email protected] Sent: Friday, 15 February, 2008 3:02:59 PM Subject: Re: [U2] Piping to a unix command with echo Unix is supposed to not process any special characters inside single quotes so drop the change commands and use SQUOTE . -- mats Marco Manyevere skrev: > Im trying to process the contents of a string generated in Universe with an > external program by shelling out to the OS as follows: > > CHANGE '\' TO '\\' IN > STR1 > CHANGE '"' TO '\"' IN STR1 > SH.CMD = 'SH -c echo ':QUOTE(STR1):' | > ./myscript' > EXECUTE SH.CMD CAPTURING RESULT > > STR1 can contain any characters > so to avoid interpratation by the shell I put the two CHANGE statements but it > seems some situations are still not covered, for example when STR1 contains > \008, the output is wrong. Does anyone know how I can make this foolproof or > an alternate method? I am able to get consistent results by writing STR1 to a > temp file then running my script with input and output redirection but I want > to cut down on unnecessary disk IO. > > Another question: While STR1 is > guaranteed not to exceed 4k, does anyone know the maximum size of the command > I can run in this way? Im on AIX. > > Marco. > __________________________________________________________ > Sent from Yahoo! > Mail - a smarter inbox http://uk.mail.yahoo.com > ------- > u2-users mailing list > [email protected] > To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/ __________________________________________________________ Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
