Redirect text from stdout to a variable?
Hey folks, Is it possible to redirect text from stdout to a variable? I do something like this and get the output on the screen: echo "Some Text to be Encrypted" | /usr/local/bin/gpg -a --always-trust --batch --no-secmem-warning -e -u "GPG Tester " -r "[EMAIL PROTECTED]" Most sites advise to do something like this if using PHP: $cmd = "echo $msg | $gpg --batch --no-secmem-warn --armor --home $home_dir \ -u $fm --default-key $fm -r $to --encrypt --sign"; $message_body = `$cmd`; mail($to,'Web Site Order',$message_body); However, "safe mode" is on, and won't let me do it. Any ideas? Start Here to Find It Fast! -> http://www.US-Webmasters.com/best-start-page/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Redirect text from stdout to a variable?
In Bourne shell: blah=$(something | something) blah2=`blah -K 2 -z` Quintin W. D. wrote: Hey folks, Is it possible to redirect text from stdout to a variable? I do something like this and get the output on the screen: echo "Some Text to be Encrypted" | /usr/local/bin/gpg -a --always-trust --batch --no-secmem-warning -e -u "GPG Tester " -r "[EMAIL PROTECTED]" Most sites advise to do something like this if using PHP: $cmd = "echo $msg | $gpg --batch --no-secmem-warn --armor --home $home_dir \ -u $fm --default-key $fm -r $to --encrypt --sign"; $message_body = `$cmd`; mail($to,'Web Site Order',$message_body); However, "safe mode" is on, and won't let me do it. Any ideas? Start Here to Find It Fast!™ -> http://www.US-Webmasters.com/best-start-page/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Redirect text from stdout to a variable?
At 05:27 1/31/2004, Quintin Riis wrote: >In Bourne shell: > >blah=$(something | something) >blah2=`blah -K 2 -z` > > Quintin Thanks, Quintin! My problem is that when I try to do something like that, I get something like this: Cannot execute using backquotes in safe mode Any other ideas? > >W. D. wrote: >> Hey folks, >> >> Is it possible to redirect text from stdout to a variable? >> >> I do something like this and get the output on the screen: >> >> echo "Some Text to be Encrypted" | /usr/local/bin/gpg -a --always-trust >--batch --no-secmem-warning -e -u "GPG Tester " -r >"[EMAIL PROTECTED]" >> >> >> >> Most sites advise to do something like this if using PHP: >> >> $cmd = "echo $msg | $gpg --batch --no-secmem-warn --armor --home $home_dir \ >> -u $fm --default-key $fm -r $to --encrypt --sign"; >> >> $message_body = `$cmd`; >> >> mail($to,'Web Site Order',$message_body); >> >> However, "safe mode" is on, and won't let me do it. Any ideas? >> >> >> >> Start Here to Find It Fast! -> http://www.US-Webmasters.com/best-start-page/ >> >> ___ >> [EMAIL PROTECTED] mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >> To unsubscribe, send any mail to "[EMAIL PROTECTED]" >> >> >> > >___ >[EMAIL PROTECTED] mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-questions >To unsubscribe, send any mail to "[EMAIL PROTECTED]" > Start Here to Find It Fast! -> http://www.US-Webmasters.com/best-start-page/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"