<?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: programming and scripting variable substitution question in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229966#M10858</link>
    <description>You can actually use *any* character.  Go Regular Expressions.  It's in the documentation somewhere (I read it once upon a time), but can't find it at the moment.&lt;BR /&gt;&lt;BR /&gt;It's just usual to use /'s as they are the default.&lt;BR /&gt;</description>
    <pubDate>Fri, 26 Mar 2004 18:14:36 GMT</pubDate>
    <dc:creator>Stuart Browne</dc:creator>
    <dc:date>2004-03-26T18:14:36Z</dc:date>
    <item>
      <title>programming and scripting variable substitution question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229960#M10852</link>
      <description>All, &lt;BR /&gt;&lt;BR /&gt;Attempting to setup a installation/configuration script to quicking blow down a complex setup of applications on RH9. &lt;BR /&gt;&lt;BR /&gt;I have the "software download and installation" complete however, I still have several files that require editing, I would prefer to add these edits to my script using inline editing with perl or sed..&lt;BR /&gt;&lt;BR /&gt;for example: &lt;BR /&gt;&lt;BR /&gt;I have a "/etc/foo/foo.conf"  &lt;BR /&gt;&lt;BR /&gt;with in the foo.conf &lt;BR /&gt;&lt;BR /&gt;I have several variables that are set usually manually with vi or emacs, &lt;BR /&gt;For example I have a variable with a path attached.. &lt;BR /&gt;var FOOCONF_PATH ../fooconf&lt;BR /&gt;&lt;BR /&gt;I want to change the FOO_PATH in the foo.conf to a full path &lt;BR /&gt;&lt;BR /&gt;var FOOCONF_PATH /etc/foo/fooconf &lt;BR /&gt;&lt;BR /&gt;I've tried the following: &lt;BR /&gt;&lt;BR /&gt;export FOOPATHOLD "var FOOCONF_PATH ../fooconf"&lt;BR /&gt;echo "Enter the new path for FOO Configs" &lt;BR /&gt;read $FOOPATHNEW&lt;BR /&gt;export FOOPATHNEW &lt;BR /&gt;///then I attempt to inline edit using variable substitutions. &lt;BR /&gt;&lt;BR /&gt;I am doing as follows: &lt;BR /&gt;&lt;BR /&gt;cp -p foo.conf foo.conf.orig &lt;BR /&gt;&lt;BR /&gt;perl -p -i -e s/$FOOPATHOLD/$FOOPATHNEW/g foo.conf &lt;BR /&gt;&lt;BR /&gt;the substitution flakes out on me.. &lt;BR /&gt;I've tried: &lt;BR /&gt;perl -p -i -e s/"$FOOPATHOLD"/"$FOOPATHNEW"/g foo.conf &lt;BR /&gt;&lt;BR /&gt;Any thoughts appreciated.. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rex M - Omaha NE &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Mar 2004 11:32:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229960#M10852</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-03-25T11:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: programming and scripting variable substitution question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229961#M10853</link>
      <description>s/FOOPATHOLD/$FOOPATHNEW/g&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Mar 2004 11:47:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229961#M10853</guid>
      <dc:creator>delahaye_1</dc:creator>
      <dc:date>2004-03-25T11:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: programming and scripting variable substitution question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229962#M10854</link>
      <description>How about using File::Basename  module?&lt;BR /&gt;dirname and basename will be usefull here...</description>
      <pubDate>Thu, 25 Mar 2004 11:51:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229962#M10854</guid>
      <dc:creator>Alexander Chuzhoy</dc:creator>
      <dc:date>2004-03-25T11:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: programming and scripting variable substitution question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229963#M10855</link>
      <description>Alex not familiar with the module, I will look into it &lt;BR /&gt;&lt;BR /&gt;An down and dirty examples you can throw at me?</description>
      <pubDate>Thu, 25 Mar 2004 11:55:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229963#M10855</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-03-25T11:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: programming and scripting variable substitution question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229964#M10856</link>
      <description>Simply put, your issue is with slashes.&lt;BR /&gt;&lt;BR /&gt;Here's an example:&lt;BR /&gt;&lt;BR /&gt;FOOPATH="var FOOCONF_PATH ../fooconf"&lt;BR /&gt;FOOPATHNEW="var FOOCONF_PATH /etc/foo/fooconf"&lt;BR /&gt;&lt;BR /&gt;perl -pi -e "s/$FOOPATH/$FOOPATHNEW/g" foo.conf&lt;BR /&gt;&lt;BR /&gt;Expand the -e, and you get:&lt;BR /&gt;&lt;BR /&gt;"s/var FOOCONF_PATH ../fooconf/var FOOCONF_PATH /etc/foo/fooconf/g"&lt;BR /&gt;&lt;BR /&gt;Way broken.&lt;BR /&gt;&lt;BR /&gt;Using something like:&lt;BR /&gt;&lt;BR /&gt;perl -pi -e "s#$FOOPATH#$FOOPATHNEW#g" foo.conf&lt;BR /&gt;&lt;BR /&gt;works just fine however.&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Mar 2004 18:58:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229964#M10856</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2004-03-25T18:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: programming and scripting variable substitution question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229965#M10857</link>
      <description>Stu, &lt;BR /&gt;using the "#" is new for me..&lt;BR /&gt;&lt;BR /&gt; Need to get my regexp book out, I tried "!" yesterday, I think I got it now.. Thanks!!! &lt;BR /&gt;&lt;BR /&gt;s#$FOOPATHOLD#$FOONEWPATH# worked. &lt;BR /&gt;&lt;BR /&gt;Rex&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Mar 2004 08:50:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229965#M10857</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-03-26T08:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: programming and scripting variable substitution question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229966#M10858</link>
      <description>You can actually use *any* character.  Go Regular Expressions.  It's in the documentation somewhere (I read it once upon a time), but can't find it at the moment.&lt;BR /&gt;&lt;BR /&gt;It's just usual to use /'s as they are the default.&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Mar 2004 18:14:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/programming-and-scripting-variable-substitution-question/m-p/3229966#M10858</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2004-03-26T18:14:36Z</dc:date>
    </item>
  </channel>
</rss>

