<?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: Really weird script problem in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624222#M104754</link>
    <description>You'll find that if you have a file by the name of 'A', 'P', '0', '4', '1' or 'D' you'll get a similar effect. Do you see why?&lt;BR /&gt;</description>
    <pubDate>Tue, 13 Sep 2005 05:48:50 GMT</pubDate>
    <dc:creator>Stephen Keane</dc:creator>
    <dc:date>2005-09-13T05:48:50Z</dc:date>
    <item>
      <title>Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624215#M104747</link>
      <description>When I run the following script the result depends on what directory I am in. The script is in /tmp.&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;DATABASE=AP0041D&lt;BR /&gt;&lt;BR /&gt;echo "1: [${DATABASE}]"&lt;BR /&gt;echo "2: [$DATABASE]"&lt;BR /&gt;echo 3: [${DATABASE}]&lt;BR /&gt;echo 4: [$DATABASE]&lt;BR /&gt;&lt;BR /&gt;When run from any directory except / the output is:&lt;BR /&gt;$ ./quotes.sh&lt;BR /&gt;1: [AP0041D]&lt;BR /&gt;2: [AP0041D]&lt;BR /&gt;3: [AP0041D]&lt;BR /&gt;4: [AP0041D]&lt;BR /&gt;&lt;BR /&gt;But from / the output is:&lt;BR /&gt;$ /tmp/quotes.sh&lt;BR /&gt;1: [AP0041D]&lt;BR /&gt;2: [AP0041D]&lt;BR /&gt;3: 1&lt;BR /&gt;4: 1&lt;BR /&gt;&lt;BR /&gt;This only happens in HP-UX. I am using HP-UX 11.11 on PA-RISC. On several other versions of Unix (AIX and SuSE SLES 8), the output is the same as the first output even when run from /&lt;BR /&gt;&lt;BR /&gt;Any ideas on how to prevent this inconsistency?</description>
      <pubDate>Mon, 12 Sep 2005 20:04:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624215#M104747</guid>
      <dc:creator>John Atkinson_2</dc:creator>
      <dc:date>2005-09-12T20:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624216#M104748</link>
      <description>Can you add set -vx in your script and execute in 11.11 (PA) ? &lt;BR /&gt;&lt;BR /&gt;-- Arun</description>
      <pubDate>Mon, 12 Sep 2005 23:50:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624216#M104748</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2005-09-12T23:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624217#M104749</link>
      <description>run from / with set -vx&lt;BR /&gt;&lt;BR /&gt;$ /tmp/quotes3.sh&lt;BR /&gt;DATABASE=AP0041D&lt;BR /&gt;+ DATABASE=AP0041D&lt;BR /&gt;&lt;BR /&gt;echo "1: [${DATABASE}]"&lt;BR /&gt;+ echo 1: [AP0041D]&lt;BR /&gt;1: [AP0041D]&lt;BR /&gt;echo "2: [$DATABASE]"&lt;BR /&gt;+ echo 2: [AP0041D]&lt;BR /&gt;2: [AP0041D]&lt;BR /&gt;echo 3: [${DATABASE}]&lt;BR /&gt;+ echo 3: 1&lt;BR /&gt;3: 1&lt;BR /&gt;echo 4: [$DATABASE]&lt;BR /&gt;+ echo 4: 1&lt;BR /&gt;4: 1</description>
      <pubDate>Mon, 12 Sep 2005 23:56:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624217#M104749</guid>
      <dc:creator>John Atkinson_2</dc:creator>
      <dc:date>2005-09-12T23:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624218#M104750</link>
      <description>Looks that script is doing what it is supposed to do. Posting of script will help.&lt;BR /&gt;Also make sure you define all required variables. Also in all variables, use ${XX}&lt;BR /&gt;&lt;BR /&gt;Also set -u will error out, when it encounters unset variable.</description>
      <pubDate>Tue, 13 Sep 2005 00:00:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624218#M104750</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-09-13T00:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624219#M104751</link>
      <description>Do you, per chance, have a file in "/" named "1", if so (and if you can safely do so) can you remove it/rename it and re-run your script in "/"</description>
      <pubDate>Tue, 13 Sep 2005 05:20:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624219#M104751</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2005-09-13T05:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624220#M104752</link>
      <description>post information on,&lt;BR /&gt;&lt;BR /&gt;# what /sbin/sh&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;DATABASE=""&lt;BR /&gt;&lt;BR /&gt;echo "1: [${DATABASE}]"&lt;BR /&gt;echo "2: [$DATABASE]"&lt;BR /&gt;echo 3: [${DATABASE}]&lt;BR /&gt;echo 4: [$DATABASE]&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;DATABASE="AP0041D"&lt;BR /&gt;&lt;BR /&gt;echo "1: [${DATABASE}]"&lt;BR /&gt;echo "2: [$DATABASE]"&lt;BR /&gt;echo 3: [${DATABASE}]&lt;BR /&gt;echo 4: [$DATABASE]&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;DATABASE=A&lt;BR /&gt;&lt;BR /&gt;echo "1: [${DATABASE}]"&lt;BR /&gt;echo "2: [$DATABASE]"&lt;BR /&gt;echo 3: [${DATABASE}]&lt;BR /&gt;echo 4: [$DATABASE]&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 13 Sep 2005 05:35:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624220#M104752</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-09-13T05:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624221#M104753</link>
      <description>What stev specified is perfectly right. Just take a look at this. &lt;BR /&gt;&lt;BR /&gt;# /tmp/weird.sh (executed from root)&lt;BR /&gt;1: [AP0041D]&lt;BR /&gt;2: [AP0041D]&lt;BR /&gt;3: [AP0041D]&lt;BR /&gt;4: [AP0041D]&lt;BR /&gt;&lt;BR /&gt;# touch 1&lt;BR /&gt;&lt;BR /&gt;# /tmp/weird.sh&lt;BR /&gt;&lt;BR /&gt;1: [AP0041D]&lt;BR /&gt;2: [AP0041D]&lt;BR /&gt;3: 1&lt;BR /&gt;4: 1&lt;BR /&gt;&lt;BR /&gt;# rm -f 1&lt;BR /&gt;&lt;BR /&gt;# /tmp/weird.sh&lt;BR /&gt;1: [AP0041D]&lt;BR /&gt;2: [AP0041D]&lt;BR /&gt;3: [AP0041D]&lt;BR /&gt;4: [AP0041D]&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Sep 2005 05:40:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624221#M104753</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2005-09-13T05:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624222#M104754</link>
      <description>You'll find that if you have a file by the name of 'A', 'P', '0', '4', '1' or 'D' you'll get a similar effect. Do you see why?&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Sep 2005 05:48:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624222#M104754</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2005-09-13T05:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624223#M104755</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;i "unprotected mode" i.e. if not protected by quotes, e.g. lines 3 and 4 in your script - the shell expands wildcards to filenames in thecurrent directory.&lt;BR /&gt;Compare:&lt;BR /&gt;# ls [AP041D]&lt;BR /&gt;&lt;BR /&gt;which will match the file names A, P, 0, 4, 1, or D in the directory you are in.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Sep 2005 06:15:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624223#M104755</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-09-13T06:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624224#M104756</link>
      <description>man sh-posix:&lt;BR /&gt;&lt;BR /&gt;"Braces are required when parameter is followed by a letter, digit, or underscore that should not be interpreted as part of its name or when a named parameter is subscripted.  If parameter is one or more digits, it is a positional parameter.A positional parameter of more than one digit must be enclosed in braces."&lt;BR /&gt;&lt;BR /&gt;And :&lt;BR /&gt;&lt;BR /&gt;Inside double quote marks (""), parameter and command substitution occurs...&lt;BR /&gt;&lt;BR /&gt;Meaning, last two echoes doesn't do the substitution...</description>
      <pubDate>Tue, 13 Sep 2005 06:19:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624224#M104756</guid>
      <dc:creator>Zeev Schultz</dc:creator>
      <dc:date>2005-09-13T06:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Really weird script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624225#M104757</link>
      <description>Brackets are interpreted as wildcards by the shell unless they are quoted. &lt;BR /&gt;The shell will match files named with any of the characters between brackets. (Single char)&lt;BR /&gt;&lt;BR /&gt;echo 3: [${DATABASE}] ==&amp;gt; echo 3: [AP0041D]&lt;BR /&gt;&lt;BR /&gt;will match any files named&lt;BR /&gt;A, P, 0, 4, 1 or D&lt;BR /&gt;&lt;BR /&gt;In your case, it seems you have a file named 1 in your / directory.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Sep 2005 06:31:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/really-weird-script-problem/m-p/3624225#M104757</guid>
      <dc:creator>Orhan Biyiklioglu</dc:creator>
      <dc:date>2005-09-13T06:31:44Z</dc:date>
    </item>
  </channel>
</rss>

