<?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: Pass a parameter that contains a dollar sign in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798931#M100401</link>
    <description>It looks like I have my morning all set with testing.  I will advise on the outcome!&lt;BR /&gt;&lt;BR /&gt;Scott</description>
    <pubDate>Fri, 02 Jun 2006 08:54:55 GMT</pubDate>
    <dc:creator>Scott Lindstrom_2</dc:creator>
    <dc:date>2006-06-02T08:54:55Z</dc:date>
    <item>
      <title>Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798923#M100393</link>
      <description>I have a script that generates an encrypted password (using makekey), then calls another script passing the new encrypted password.  I am finding sometimes makekey gens a key that starts with a dollar sign.  So I get this situation:&lt;BR /&gt;&lt;BR /&gt;First script calls the second script:&lt;BR /&gt;&lt;BR /&gt;&lt;SECOND script="" name=""&gt; $THqj3LornI/c &lt;BR /&gt;&lt;BR /&gt;The second script echos the parameter received:&lt;BR /&gt;+ newpass=/c&lt;BR /&gt;&lt;BR /&gt;Obviously not correct.&lt;BR /&gt;&lt;BR /&gt;I also have this example:&lt;BR /&gt;&lt;BR /&gt;&amp;lt;script name&amp;gt; $TAs5SRJ.tlhQ &lt;BR /&gt;+ newpass=.tlhQ&lt;BR /&gt;&lt;BR /&gt;Is the leading dollar sign causing this behavior?  If so, do I change the calling script or the called script (and how)?&lt;BR /&gt;&lt;BR /&gt;TIA,&lt;BR /&gt;&lt;BR /&gt;Scott&lt;/SECOND&gt;</description>
      <pubDate>Thu, 01 Jun 2006 16:20:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798923#M100393</guid>
      <dc:creator>Scott Lindstrom_2</dc:creator>
      <dc:date>2006-06-01T16:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798924#M100394</link>
      <description>Yes, the variable $TAs5SRJ is not defined and is thus a null value. &lt;BR /&gt;&lt;BR /&gt;&amp;lt;script name&amp;gt; "\$TAs5SRJ.tlhQ"&lt;BR /&gt;&lt;BR /&gt;will fix you as the \ is escaping the special meaning of $.</description>
      <pubDate>Thu, 01 Jun 2006 16:25:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798924#M100394</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-06-01T16:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798925#M100395</link>
      <description>Thanks!  I'll have to test and see if I can always lead with a \ (without testing what the first character of the password is), or if I should only do it if the first character is a $.&lt;BR /&gt;&lt;BR /&gt;Scott</description>
      <pubDate>Thu, 01 Jun 2006 16:28:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798925#M100395</guid>
      <dc:creator>Scott Lindstrom_2</dc:creator>
      <dc:date>2006-06-01T16:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798926#M100396</link>
      <description>Actually what is have to do is precede EVERY '$' with \ no matter where (or how many times) it occurs in the string.</description>
      <pubDate>Thu, 01 Jun 2006 16:34:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798926#M100396</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-06-01T16:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798927#M100397</link>
      <description>That makes it a bit more interesting.  Is there an easy way to do that?&lt;BR /&gt;&lt;BR /&gt;For example, if I had:&lt;BR /&gt;$hj7f$k38$$l&lt;BR /&gt;&lt;BR /&gt;could I run it through some command to get:&lt;BR /&gt;&lt;BR /&gt;\$hj7f\$k38\$\$l&lt;BR /&gt;&lt;BR /&gt;Scott</description>
      <pubDate>Thu, 01 Jun 2006 16:40:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798927#M100397</guid>
      <dc:creator>Scott Lindstrom_2</dc:creator>
      <dc:date>2006-06-01T16:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798928#M100398</link>
      <description>The problem that you encounter with trying to create a function is the very same one you now face; how do you pass the paramter. It's easy if it's a constant because quoting will fix you. In your case, perhaps the easist method is to allow a temporary file to serve for you. Rather that capturing the output of makekey in a variable save it to a temporary file. The temp file should be PID dependent so that collisions won't occur and the mode of the file should be very restrictive as well -- although a hash created by makekey is difficult to crack -- assuming non-trivial plaintext is input. You should also have a trap to remove this temp file upon exit or receipt of common signals.</description>
      <pubDate>Thu, 01 Jun 2006 17:40:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798928#M100398</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-06-01T17:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798929#M100399</link>
      <description>Okay I've thought a little bit about it and this technique should work. &lt;BR /&gt;&lt;BR /&gt;Rather than capturing makekey's stdout in a variable directly do something like this:&lt;BR /&gt;&lt;BR /&gt;PLAINTEXT="12345678.k"&lt;BR /&gt;PWHASH=$(echo "${PLAINTEXT}" | /usr/lbin/makekey | awk '{gsub("$","\$"); print $0}')&lt;BR /&gt;echo "PWHASH = \"${PWHASH}\""&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Jun 2006 18:05:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798929#M100399</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-06-01T18:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798930#M100400</link>
      <description>Hi Scott:&lt;BR /&gt;&lt;BR /&gt;You asked:&lt;BR /&gt;&lt;BR /&gt;/* begin quote */&lt;BR /&gt;For example, if I had:&lt;BR /&gt;$hj7f$k38$$l&lt;BR /&gt;&lt;BR /&gt;could I run it through some command to get:&lt;BR /&gt;&lt;BR /&gt;\$hj7f\$k38\$\$l&lt;BR /&gt;&lt;BR /&gt;/* end quote */&lt;BR /&gt;&lt;BR /&gt;...Yes, here's a simple way:&lt;BR /&gt;&lt;BR /&gt;# echo '$hj7f$k38$$l'|perl -ne 'print quotemeta'&lt;BR /&gt;\$hj7f\$k38\$\$l\&lt;BR /&gt;&lt;BR /&gt;# X=`echo '$hj7f$k38$$l'|perl -ne 'print quotemeta'`; echo ${X}&lt;BR /&gt;\$hj7f\$k38\$\$l\&lt;BR /&gt;&lt;BR /&gt;Note that we use single quote marks around the string to prevent the shell from interpreting the dollar-signs.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 01 Jun 2006 20:38:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798930#M100400</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-06-01T20:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798931#M100401</link>
      <description>It looks like I have my morning all set with testing.  I will advise on the outcome!&lt;BR /&gt;&lt;BR /&gt;Scott</description>
      <pubDate>Fri, 02 Jun 2006 08:54:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798931#M100401</guid>
      <dc:creator>Scott Lindstrom_2</dc:creator>
      <dc:date>2006-06-02T08:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798932#M100402</link>
      <description>Hi (again) Scoot:&lt;BR /&gt;&lt;BR /&gt;One small correction - the addition of the '-l' switch so the snippets read:&lt;BR /&gt;&lt;BR /&gt;# echo '$hj7f$k38$$l'|perl -nle 'print quotemeta'&lt;BR /&gt;\$hj7f\$k38\$\$l&lt;BR /&gt;&lt;BR /&gt;(and):&lt;BR /&gt;&lt;BR /&gt;# X=`echo '$hj7f$k38$$l'|perl -nle 'print quotemeta'`; echo ${X}&lt;BR /&gt;\$hj7f\$k38\$\$l&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 02 Jun 2006 09:16:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798932#M100402</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-06-02T09:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798933#M100403</link>
      <description>&lt;!--!*#--&gt;or you can run it thru sed, &lt;BR /&gt;&lt;BR /&gt;echo "12345.k" | /usr/lbin/makekey | sed s/\\$/\\\\$/g</description>
      <pubDate>Fri, 02 Jun 2006 13:54:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798933#M100403</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2006-06-02T13:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798934#M100404</link>
      <description>This thread's a bit old, but the right &lt;BR /&gt;solution is vastly simpler than all of the&lt;BR /&gt;other suggestions.&lt;BR /&gt;&lt;BR /&gt;When the first script calls the second,&lt;BR /&gt;it need only place the encrypted string in&lt;BR /&gt;single quotes. This will prevent any attempt&lt;BR /&gt;to interpret the argument as a shell variable.&lt;BR /&gt;&lt;BR /&gt;tim&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jul 2006 10:09:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798934#M100404</guid>
      <dc:creator>TimButler</dc:creator>
      <dc:date>2006-07-14T10:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798935#M100405</link>
      <description>Well Tim, the whole problem is that this is not a constant; that would be easy. Instead it's a variable that may happen to include the "$" metacharacter (or more than 1).</description>
      <pubDate>Fri, 14 Jul 2006 12:21:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798935#M100405</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-07-14T12:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798936#M100406</link>
      <description>&lt;!--!*#--&gt;Clay said:&lt;BR /&gt;the whole problem is that this is not a constant; that would be easy. Instead it's a variable that may happen to include the "$" metacharacter&lt;BR /&gt;&lt;BR /&gt;Yes, I also thought it was as simple as Tim said.&lt;BR /&gt;&lt;BR /&gt;Here are my two scripts:&lt;BR /&gt;$ more dollar_parm&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;ABC=$(echo '$def/sam') # generate key&lt;BR /&gt;echo $ABC&lt;BR /&gt;dollar_parm2 "$ABC"    # quotes not needed&lt;BR /&gt;&lt;BR /&gt;$ more dollar_parm2&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;echo $1&lt;BR /&gt;&lt;BR /&gt;Both scripts echo: $def/sam&lt;BR /&gt;&lt;BR /&gt;It seems that once you get a $ in a parm, it will stay there.  So you should be able to capture the output of makekey and pass that.</description>
      <pubDate>Fri, 14 Jul 2006 15:13:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798936#M100406</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-07-14T15:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a parameter that contains a dollar sign</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798937#M100407</link>
      <description>hmm&lt;BR /&gt;&lt;BR /&gt;I too, think the issue is somewhat easier than Clay avers. &lt;BR /&gt;&lt;BR /&gt;create encrypted password using makekey, assigning same to a variable name. Call subsequent script with this variable as an arguement. &lt;BR /&gt;&lt;BR /&gt;An interactive example: &lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;read password&lt;BR /&gt;my_key=`echo ${password}|/usr/lbin/makekey`&lt;BR /&gt;&lt;BR /&gt;;# now call subsequent script with my_key&lt;BR /&gt;&lt;BR /&gt;next_script ${my_key} &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;next_script then can act on $1 (or whichever arguement was passed)  &lt;BR /&gt;If you desire to reassign $1 to some other more logically named variable, that is done normally&lt;BR /&gt;newpass=$1&lt;BR /&gt;when using newpass, just enclose with brackets as was done with my_key in the first script.</description>
      <pubDate>Fri, 14 Jul 2006 15:57:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-a-parameter-that-contains-a-dollar-sign/m-p/3798937#M100407</guid>
      <dc:creator>Mark Fenton</dc:creator>
      <dc:date>2006-07-14T15:57:02Z</dc:date>
    </item>
  </channel>
</rss>

