<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to redirection Standard error to an env variable instead of a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554654#M225574</link>
    <description>Hi yyghp,&lt;BR /&gt;&lt;BR /&gt; if the script you are using doesnot throw up any output message and only error output..&lt;BR /&gt;u could write a script like this...&lt;BR /&gt;&lt;BR /&gt;------------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;ERR=`/path/ldappasswd 2&amp;gt;&amp;amp;1`&lt;BR /&gt;if [ ERR .....form here on your logic...&lt;BR /&gt;&lt;BR /&gt;------------------------------------&lt;BR /&gt;&lt;BR /&gt;The character around /path/ldappasswd 2&amp;gt;&amp;amp;1 is a back quote ,the one u find before "key 1" in KB.&lt;BR /&gt;&lt;BR /&gt;NOTE:&lt;BR /&gt;But mind you, if the error message is multilined..the "\n" enter character will be stripped off and made into single line and put in the variable.</description>
    <pubDate>Mon, 30 May 2005 17:00:35 GMT</pubDate>
    <dc:creator>Senthil Kumar .A_1</dc:creator>
    <dc:date>2005-05-30T17:00:35Z</dc:date>
    <item>
      <title>How to redirection Standard error to an env variable instead of a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554652#M225572</link>
      <description>I am writing a script used for quite a bunch of users. I use the command "ldappasswd" in the script for the user to change their password. While the errors are not friendly to the users, such as "ldap_bind: Invalid credentials" if they type the wrong old password.&lt;BR /&gt;I would like to redirect such error to an environment variable, and compare the error strings, then echo some friendly words to the standard output.&lt;BR /&gt;I know I can redirect the error to a file, like: &lt;BR /&gt;ldappasswd &lt;ARGS&gt;   2&amp;gt;errorfile&lt;BR /&gt;But is it possible to redirect the standard error to a variable ?&lt;BR /&gt;Thanks!&lt;/ARGS&gt;</description>
      <pubDate>Mon, 30 May 2005 16:35:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554652#M225572</guid>
      <dc:creator>yyghp</dc:creator>
      <dc:date>2005-05-30T16:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirection Standard error to an env variable instead of a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554653#M225573</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;try ldappasswd 2&amp;gt;&amp;amp;1 &amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 30 May 2005 16:54:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554653#M225573</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2005-05-30T16:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirection Standard error to an env variable instead of a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554654#M225574</link>
      <description>Hi yyghp,&lt;BR /&gt;&lt;BR /&gt; if the script you are using doesnot throw up any output message and only error output..&lt;BR /&gt;u could write a script like this...&lt;BR /&gt;&lt;BR /&gt;------------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;ERR=`/path/ldappasswd 2&amp;gt;&amp;amp;1`&lt;BR /&gt;if [ ERR .....form here on your logic...&lt;BR /&gt;&lt;BR /&gt;------------------------------------&lt;BR /&gt;&lt;BR /&gt;The character around /path/ldappasswd 2&amp;gt;&amp;amp;1 is a back quote ,the one u find before "key 1" in KB.&lt;BR /&gt;&lt;BR /&gt;NOTE:&lt;BR /&gt;But mind you, if the error message is multilined..the "\n" enter character will be stripped off and made into single line and put in the variable.</description>
      <pubDate>Mon, 30 May 2005 17:00:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554654#M225574</guid>
      <dc:creator>Senthil Kumar .A_1</dc:creator>
      <dc:date>2005-05-30T17:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirection Standard error to an env variable instead of a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554655#M225575</link>
      <description>Yes. But preferred way is as like,&lt;BR /&gt;&lt;BR /&gt;ldappasswd &lt;ARGS&gt; | grep -q "ldap_bind: Invalid credentials"&lt;BR /&gt;if [[ $? -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "action got error"&lt;BR /&gt;else&lt;BR /&gt;  echo "ok"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;grep -q will be used to search string in silent mode.&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/ARGS&gt;</description>
      <pubDate>Tue, 31 May 2005 06:07:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554655#M225575</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-05-31T06:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirection Standard error to an env variable instead of a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554656#M225576</link>
      <description>Oups,&lt;BR /&gt;&lt;BR /&gt;I copyied only half of what I wanted.&lt;BR /&gt;That should have been&lt;BR /&gt;ERR=`ldappasswd 2&amp;gt;&amp;amp;1 &amp;gt;/dev/null`&lt;BR /&gt;which is roughly the same as that from senthil.&lt;BR /&gt;If you need the stdout too then you can redirect stderr to file and read it into a variable.&lt;BR /&gt;ldappasswd args 2&amp;gt;errorlog&lt;BR /&gt;ERR=`cat errorlog`&lt;BR /&gt;&lt;BR /&gt;Michael</description>
      <pubDate>Tue, 31 May 2005 06:14:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554656#M225576</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2005-05-31T06:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirection Standard error to an env variable instead of a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554657#M225577</link>
      <description>command substitution will let you get at what you want...&lt;BR /&gt;&lt;BR /&gt;# ERR=$(ldappasswd &lt;ARGS&gt; 2&amp;gt;&amp;amp;1)&lt;BR /&gt;OR&lt;BR /&gt;# ERR=`ldappasswd &lt;ARGS&gt; 2&amp;gt;&amp;amp;1`&lt;BR /&gt;&lt;BR /&gt;both these forms should work.&lt;/ARGS&gt;&lt;/ARGS&gt;</description>
      <pubDate>Tue, 31 May 2005 11:23:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-redirection-standard-error-to-an-env-variable-instead-of/m-p/3554657#M225577</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-05-31T11:23:23Z</dc:date>
    </item>
  </channel>
</rss>

