<?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: Error in user setting making grep behave badly in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989260#M780852</link>
    <description>Grep is behaving exactly as it is supposed to; you scripting is sloppy because consider the case when there is a file (or files) "0" - "9" in the current working directory. The shell dutifully expands your pattern and supplies them as your argument to grep.&lt;BR /&gt;&lt;BR /&gt;The fix is quite simple&lt;BR /&gt;echo 7 | grep '[0-9]'&lt;BR /&gt;&lt;BR /&gt;although a more rigourous test would also anchor the target pattern:&lt;BR /&gt;&lt;BR /&gt;echo "7" | grep -E '^[0-9]$'&lt;BR /&gt;&lt;BR /&gt;This will only match a single digit.</description>
    <pubDate>Thu, 06 Jul 2006 16:09:19 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2006-07-06T16:09:19Z</dc:date>
    <item>
      <title>Error in user setting making grep behave badly</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989258#M780850</link>
      <description>HI,&lt;BR /&gt;I have an unexpected  behaviour for one particular user on my HP-US 11i system&lt;BR /&gt;The following command: echo 7 | grep [0-9] is not working properly in a script or on the prompt.&lt;BR /&gt;example:&lt;BR /&gt;maestro@[dm3czo]echo 7 | grep [0-9]&lt;BR /&gt;1:        TERM=vt100&lt;BR /&gt;1:      MAESTROLINES=0&lt;BR /&gt;1:      PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/opt/maestro:/opt/maestro/bin:.:/opt/syncsort380/lib:/stage/syncsort350/lib ; export PATH&lt;BR /&gt;1:SHLIB_PATH=/opt/syncsort/lib:/opt/syncsort380/lib/:/stage/syncsort350/lib; export SHLIB_PATH&lt;BR /&gt;1:      trap "echo 'logout'" 0&lt;BR /&gt;1:        umask 007&lt;BR /&gt;1:tput sgr0&lt;BR /&gt;1:tput sgr0&lt;BR /&gt;&lt;BR /&gt;This is like the content of the .profile is passed to the grep command.&lt;BR /&gt;&lt;BR /&gt;But this command is working just fine for others user: &lt;BR /&gt;&lt;BR /&gt;cfrenett@dm3czo:/home/cfrenett&amp;gt;echo 7 | grep [0-9]&lt;BR /&gt;7&lt;BR /&gt;&lt;BR /&gt;I have try to locate the difference in the settings of theses users and I cannot find any major differences.&lt;BR /&gt;Do you have an idea where I can look to correct this problem?&lt;BR /&gt;Thanks,&lt;BR /&gt;Charles.</description>
      <pubDate>Thu, 06 Jul 2006 15:28:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989258#M780850</guid>
      <dc:creator>Charles Frenette</dc:creator>
      <dc:date>2006-07-06T15:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Error in user setting making grep behave badly</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989259#M780851</link>
      <description>echo 7 command converting itself to env output did not make much sense, but chek to see if the shells of the two users are the same.&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Jul 2006 16:08:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989259#M780851</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2006-07-06T16:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error in user setting making grep behave badly</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989260#M780852</link>
      <description>Grep is behaving exactly as it is supposed to; you scripting is sloppy because consider the case when there is a file (or files) "0" - "9" in the current working directory. The shell dutifully expands your pattern and supplies them as your argument to grep.&lt;BR /&gt;&lt;BR /&gt;The fix is quite simple&lt;BR /&gt;echo 7 | grep '[0-9]'&lt;BR /&gt;&lt;BR /&gt;although a more rigourous test would also anchor the target pattern:&lt;BR /&gt;&lt;BR /&gt;echo "7" | grep -E '^[0-9]$'&lt;BR /&gt;&lt;BR /&gt;This will only match a single digit.</description>
      <pubDate>Thu, 06 Jul 2006 16:09:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989260#M780852</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-07-06T16:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error in user setting making grep behave badly</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989261#M780853</link>
      <description>Start with verifying the actual commands:&lt;BR /&gt; &lt;BR /&gt;type grep&lt;BR /&gt;type echo&lt;BR /&gt;type 7&lt;BR /&gt; &lt;BR /&gt;The type command (actually whence -v) tells you what the string will produce when the shell sees that string. The results should be:&lt;BR /&gt; &lt;BR /&gt;&amp;gt; grep is a tracked alias for /usr/bin/grep&lt;BR /&gt;&amp;gt; echo is a shell builtin.&lt;BR /&gt;&amp;gt; 7 not found.&lt;BR /&gt;&lt;BR /&gt;then look at the environment by typing the commands:&lt;BR /&gt; &lt;BR /&gt;alias&lt;BR /&gt;set&lt;BR /&gt; &lt;BR /&gt;Look for strange character strings in the alias and set commands.&lt;BR /&gt; &lt;BR /&gt;BTW: the PATH statement has several concerns:&lt;BR /&gt; &lt;BR /&gt;/bin hasn't existed for more than a dozen years. The correct path is /usr/bin. /bin is a temporary transition link.&lt;BR /&gt;&lt;BR /&gt;/usr/local/bin should be checked for the correct permissions. The default is 777 which is unacceptable for PATH usage. Make sure /usr/local/bin is 775 or 755.&lt;BR /&gt; &lt;BR /&gt;:.: is in the path. All seasoned admins will agree that having . (the current working directory) is a bad security risk.</description>
      <pubDate>Thu, 06 Jul 2006 16:19:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989261#M780853</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2006-07-06T16:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error in user setting making grep behave badly</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989262#M780854</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Clay's response (matching a filename surely put you to the cause of your problem. I want to add:&lt;BR /&gt;- your problem is NOT user specific - if you change to the path, where the command was called by that user, every user with read acces to that directory would get that result.&lt;BR /&gt;- to get an exact match, you can use&lt;BR /&gt;echo 7 | grep -x '[0-9]'&lt;BR /&gt;  The option '-x' anchors your pattern at the beginning and at the end of a line lile '^[0-9]$' but is valid for the whole match:&lt;BR /&gt;egrep -x '[0-9]|aa' matches a line containing exactly one digit or a single 'aa'.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 07 Jul 2006 06:33:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989262#M780854</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-07-07T06:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error in user setting making grep behave badly</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989263#M780855</link>
      <description>Thanks to all of you. &lt;BR /&gt;The problem was that a file 1 was existing in the home of that user and contains the output of the env commant. &lt;BR /&gt;And the correction to the grep resolve my issue. &lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;Charles.</description>
      <pubDate>Fri, 07 Jul 2006 08:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-in-user-setting-making-grep-behave-badly/m-p/4989263#M780855</guid>
      <dc:creator>Charles Frenette</dc:creator>
      <dc:date>2006-07-07T08:12:59Z</dc:date>
    </item>
  </channel>
</rss>

