Re: Redirect text from stdout to a variable?

From: Quintin Riis (webmaster_at_countrypure.net)
Date: 01/31/04

  • Next message: Quintin Riis: "Re: One of your employees are very rude."
    Date: Sat, 31 Jan 2004 05:27:51 -0600
    To: "W. D." <WD@US-Webmasters.com>
    
    

    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 "SomeDude@TheDudesDomain.com"
    >
    >
    >
    > 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/
    >
    > _______________________________________________
    > freebsd-questions@freebsd.org mailing list
    > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
    >
    >
    >

    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: Quintin Riis: "Re: One of your employees are very rude."

    Relevant Pages

    • Redirect text from stdout to a variable?
      ... Hey folks, ... Is it possible to redirect text from stdout to a variable? ... To unsubscribe, ...
      (freebsd-questions)
    • Re: Backgrounding a stream, and sendmail?
      ... >> just redirect the output to a file instead of sendmail.) ... > shell command like ... when prog_b has it's stdout redirected nothing ... > is done instead of printing to stdout you could start sendmail from within ...
      (comp.os.linux.development.apps)
    • stdout redirection
      ... I am trying to redirect stdout to a RichEdit control, ... text from the StringBuilder is being copied. ... DLLs are using printf*.* to write to the stdout, ...
      (microsoft.public.dotnet.languages.csharp)
    • stdout redirection
      ... I am trying to redirect stdout to a RichEdit control, ... text from the StringBuilder is being copied. ... DLLs are using printf*.* to write to the stdout, ...
      (microsoft.public.dotnet.languages.vc)
    • Redirecting STDOUT under ActivePerl on Windows XP
      ... I want to redirect STDOUT to a file, and have the redirection apply to ... any programs that I invoke. ... print "outer calling middle\n"; ...
      (comp.lang.perl.misc)