Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Jan 2004 04:04:57 -0600
From:      "W. D." <WD@US-Webmasters.com>
To:        questions@freebsd.org
Subject:   Redirect text from stdout to a variable?
Message-ID:  <5.1.0.14.2.20040131035740.07828af0@209.152.117.178>

next in thread | raw e-mail | index | archive | help
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=
 "SomeDude@TheDudesDomain.com"



Most sites advise to do something like this if using PHP:

$cmd =3D "echo $msg | $gpg --batch --no-secmem-warn --armor --home $home_dir=
 \
 -u $fm --default-key $fm -r $to --encrypt --sign";

$message_body =3D `$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!=99 -> http://www.US-Webmasters.com/best-start-pa=
ge/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.1.0.14.2.20040131035740.07828af0>