<?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: abnormal execution of &amp;quot;tr&amp;quot; command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274407#M179221</link>
    <description>Clay, I think is correct about the shell expanding the [a-z] [A-Z], try changing directories, and doing the tr again, it should work. &lt;BR /&gt;&lt;BR /&gt;I can reproduce your error, from my / directory but it works fine in another directory for me. &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 12 May 2004 14:30:32 GMT</pubDate>
    <dc:creator>Marvin Strong</dc:creator>
    <dc:date>2004-05-12T14:30:32Z</dc:date>
    <item>
      <title>abnormal execution of "tr" command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274403#M179217</link>
      <description># echo charlie | tr [a-z] [A-Z]&lt;BR /&gt;Aharlie&lt;BR /&gt;#&lt;BR /&gt;# whereis tr&lt;BR /&gt;tr: /usr/bin/tr /usr/share/man/man1.Z/tr.1&lt;BR /&gt;&lt;BR /&gt;copied tr executable from another node into /tmp/tr&lt;BR /&gt;&lt;BR /&gt;# diff /usr/bin/tr /tmp/tr&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;(no difference)&lt;BR /&gt;&lt;BR /&gt;# echo abcd | /tmp/tr [a-z] [A-Z]&lt;BR /&gt;abAd&lt;BR /&gt;&lt;BR /&gt;OS is hpux 11.11&lt;BR /&gt;&lt;BR /&gt;TIA&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 May 2004 14:04:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274403#M179217</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2004-05-12T14:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: abnormal execution of "tr" command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274404#M179218</link>
      <description>have you tried quoting the strings to protect from interpretation by the shell, such as:&lt;BR /&gt;&lt;BR /&gt;tr "[a-z]" "[A-Z]"</description>
      <pubDate>Wed, 12 May 2004 14:14:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274404#M179218</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-05-12T14:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: abnormal execution of "tr" command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274405#M179219</link>
      <description>Mel,&lt;BR /&gt;&lt;BR /&gt;That's extremely odd!!  I tried it on my 11i workstation and it came out fine:&lt;BR /&gt;&lt;BR /&gt;root# echo charlie | tr [a-z] [A-Z]&lt;BR /&gt;CHARLIE&lt;BR /&gt;root# what /usr/bin/tr&lt;BR /&gt;/usr/bin/tr:&lt;BR /&gt;         $Revision: B.11.11_LR&lt;BR /&gt;         Fri Oct 27 01:01:23 PDT 2000 $&lt;BR /&gt;root# uname -a&lt;BR /&gt;HP-UX tsws1 B.11.11 U 9000/785 2006183676 unlimited-user license&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 12 May 2004 14:16:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274405#M179219</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2004-05-12T14:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: abnormal execution of "tr" command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274406#M179220</link>
      <description>I suspect what is going on is that the shell is strangely expanding your [a-z] [A-Z] depending upon what files are present in your CWD. Always protect your translation strings with quotes.&lt;BR /&gt;&lt;BR /&gt;echo "charlie" | tr '[a-z]' '[A-Z]'&lt;BR /&gt;&lt;BR /&gt;I suspect that that will work as expected.&lt;BR /&gt;</description>
      <pubDate>Wed, 12 May 2004 14:21:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274406#M179220</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-05-12T14:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: abnormal execution of "tr" command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274407#M179221</link>
      <description>Clay, I think is correct about the shell expanding the [a-z] [A-Z], try changing directories, and doing the tr again, it should work. &lt;BR /&gt;&lt;BR /&gt;I can reproduce your error, from my / directory but it works fine in another directory for me. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 May 2004 14:30:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274407#M179221</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2004-05-12T14:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: abnormal execution of "tr" command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274408#M179222</link>
      <description>&lt;BR /&gt;I am not sure what is causing it but it really bugs me right at the moment. all other 34 servers in my data center responded right to this command but this one. Looks like, for some strange reason, it was hung on lower case c character and thinks that it maps to upper case a, as if my [a-z] [A-Z] mapping does not expand as [abcd...xyz] [ABCD...XYZ].&lt;BR /&gt;&lt;BR /&gt;When I double quoted the [a-z} and [A-Z] expressions, it works. I also tried expanding the sequences by typing all 26 letters in between, this time output turned out to be&lt;BR /&gt;&lt;BR /&gt;# echo abcd | /tmp/tr [abcdefghijklmnopqrstuvwxyz] [ABCDEFGHIJKLMNOPQRSTUVWXYZ]&lt;BR /&gt;ab[d&lt;BR /&gt;&lt;BR /&gt;I was running this command as root. When I run it as my mortal userid, i.e., after running su - mortal, it works fine&lt;BR /&gt;&lt;BR /&gt;Also, while I was tying this response andrefreshing the screen to read further responses, yes I changed my working directory of root, which was /root, to / or any other for that matter and the command works fine. Looking at my environment variables, there is nothing fancy about my prompt or any other signficant redirections of any sort.. strange.. but thanks for all the help&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;</description>
      <pubDate>Wed, 12 May 2004 14:39:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274408#M179222</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2004-05-12T14:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: abnormal execution of "tr" command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274409#M179223</link>
      <description>The fundamental wrong turn was in thinking that this was a tr problem when rather than  a shell "problem". Tr was simply acting upon the data passed to it by the shell --- which was not necessarily the same thing that you typed. For the same reason that I always surround shell variables with {}'s, I always surround string constants with quotes. It that case, what you type IS what you get.&lt;BR /&gt;</description>
      <pubDate>Wed, 12 May 2004 15:29:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274409#M179223</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-05-12T15:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: abnormal execution of "tr" command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274410#M179224</link>
      <description>Hi,&lt;BR /&gt;it has to do with the files in the directory on which the shell tries to perform filename substitution. If you for instance have a file whose name is "c" in the directory, then an expansion could look like this:&lt;BR /&gt;# ls [a-z]&lt;BR /&gt;c&lt;BR /&gt;&lt;BR /&gt;If you also have e.g. a file named A, then the shell would expand to this:&lt;BR /&gt;ls [A-Z]&lt;BR /&gt;A&lt;BR /&gt;&lt;BR /&gt;In which case your command would look like this after file name substitution:&lt;BR /&gt;# echo charlie | tr c A&lt;BR /&gt;Aharlie&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It is only a suggestion; you would get a similar result even if you had no file name starting with "A".  &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;  &lt;BR /&gt;</description>
      <pubDate>Wed, 12 May 2004 15:39:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274410#M179224</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2004-05-12T15:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: abnormal execution of "tr" command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274411#M179225</link>
      <description>John (and others) are right.&lt;BR /&gt;&lt;BR /&gt;Type the tr command without quotes again, and press ESC twice after typing [a-z] to have the shell expand the string, and do the same for [A-Z]. I assume vi-mode here. Now you can see what is actually being executed.&lt;BR /&gt;&lt;BR /&gt;I wonder what tr will do if more than 1 filename fits. Tr will probably complain; to expand you must type ESC followed by '*'.&lt;BR /&gt;&lt;BR /&gt;I've spent some time on this a few (more than 10) years ago. Always hide wildcards from the shell. &lt;BR /&gt;&lt;BR /&gt;Another example (took half a day to solve):&lt;BR /&gt;Don't do: tar xvf /dev/rmt/... /etc/*&lt;BR /&gt;if you want to restore the files you removed from /etc. It will only restore files in /etc that are already present because of filename expansion by the shell...&lt;BR /&gt;&lt;BR /&gt;JP</description>
      <pubDate>Wed, 12 May 2004 16:17:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/abnormal-execution-of-quot-tr-quot-command/m-p/3274411#M179225</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-05-12T16:17:50Z</dc:date>
    </item>
  </channel>
</rss>

