echo problem when escaping gpg commands

From: Date: Fri, 16 Jun 2000 01:08:27 +0000
Subject: echo problem when escaping gpg commands
Groups: php.general 
Request: Send a blank email to php-general+get-2021@lists.php.net to get a copy of this message
I'm having difficulty piping input into the gpg command. The line below works because echo only has one line to output. $last_line = exec("echo \"blue\" | gpg -a -e ", $out_ary, $cmd_retun); As soon as I try to echo a variable that contains \n, echo only prints/pipes the first line. Therefore, the gpg command fails. $var = "big\n red\n herring\n"; $last_line = exec("echo $var | gpg -a -e ", $out_ary, $cmd_retun); Any suggestions?

« previous php.general (#2021) next »