<?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: PATH value in a variable in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832829#M100533</link>
    <description>Pete,&lt;BR /&gt;&lt;BR /&gt;You are wrong. The final PATH must be:&lt;BR /&gt;FULL_PATH=$MAIN_PATH/$SUPPLEMENTARY_PATH&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
    <pubDate>Fri, 28 Jul 2006 07:17:37 GMT</pubDate>
    <dc:creator>Jose Mosquera</dc:creator>
    <dc:date>2006-07-28T07:17:37Z</dc:date>
    <item>
      <title>PATH value in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832827#M100531</link>
      <description>Hi pals,&lt;BR /&gt;&lt;BR /&gt;Please look this simple script content:&lt;BR /&gt;MAIN_PATH=/usr/local/bin&lt;BR /&gt;SUPPLEMENTARY_PATH=../..&lt;BR /&gt;FULL_PATH=$MAIN_PATH/$SUPPLEMENTARY_PATH&lt;BR /&gt;echo $FULL_PATH&lt;BR /&gt;&lt;BR /&gt;/usr/local/bin/../..&lt;BR /&gt;&lt;BR /&gt;How can I obtain (on-the-fly) the real/final path info content into $FULL_PATH? In this case must be "/usr".&lt;BR /&gt;&lt;BR /&gt;Please omit the possibility to move to $FULL_PATH and to obtain the value of $PWD, I need to know the real/final content before moving.&lt;BR /&gt;&lt;BR /&gt;For those that have a solution, please think that it would happen in this deliberate erroneous case of variable definition:  &lt;BR /&gt;SUPPLEMENTARY_PATH=../../../../../..&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
      <pubDate>Fri, 28 Jul 2006 07:03:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832827#M100531</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2006-07-28T07:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: PATH value in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832828#M100532</link>
      <description>I'm not sure what you're really asking here but your syntax is wrong for a path.  It should be &lt;BR /&gt;&lt;BR /&gt;FULL_PATH=$MAIN_PATH:$SUPPLEMENTARY_PATH&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 28 Jul 2006 07:07:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832828#M100532</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2006-07-28T07:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: PATH value in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832829#M100533</link>
      <description>Pete,&lt;BR /&gt;&lt;BR /&gt;You are wrong. The final PATH must be:&lt;BR /&gt;FULL_PATH=$MAIN_PATH/$SUPPLEMENTARY_PATH&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
      <pubDate>Fri, 28 Jul 2006 07:17:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832829#M100533</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2006-07-28T07:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: PATH value in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832830#M100534</link>
      <description>If you can access the MAIN_PATH and SUPPLEMENTARY_PATH variables directly, I'd do some sort of loop counting the number of '..'s in SUPPLEMENTARY_PATH and using the 'dirname' command to remove directories from MAIN_PATH. Something like:&lt;BR /&gt;&lt;BR /&gt;MAINPATH=/usr/local/bin&lt;BR /&gt;SUPPPATH=../..&lt;BR /&gt;&lt;BR /&gt;while [ $(echo $SUPPPATH | grep -c "\.\.") -gt 0 ]; do&lt;BR /&gt;  SUPPPATH=$(dirname $SUPPPATH)&lt;BR /&gt;  MAINPATH=$(dirname $MAINPATH)&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;echo $MAINPATH&lt;BR /&gt;&lt;BR /&gt;There's probably an elegant perl script that will do the same...</description>
      <pubDate>Fri, 28 Jul 2006 07:19:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832830#M100534</guid>
      <dc:creator>Jonathan Fife</dc:creator>
      <dc:date>2006-07-28T07:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: PATH value in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832831#M100535</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;try with perl:&lt;BR /&gt;&lt;BR /&gt;perl -e 'use Cwd 'abs_path'; print abs_path($ARGV[0]) . "\n";' PATHNAME&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 28 Jul 2006 07:54:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832831#M100535</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-07-28T07:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: PATH value in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832832#M100536</link>
      <description>Ups,&lt;BR /&gt;&lt;BR /&gt;though functional, I recommend stripping some quotes:&lt;BR /&gt;&lt;BR /&gt;perl -e 'use Cwd abs_path; print abs_path($ARGV[0]) . "\n";' PATHNAME&lt;BR /&gt;&lt;BR /&gt;Sorry.&lt;BR /&gt;&lt;BR /&gt;Additionally, here is a awk-function that did this as well, if I remember correctly:&lt;BR /&gt;&lt;BR /&gt;awk 'function pathexp (name) { numdir=split(name,p,"/")&lt;BR /&gt;ndir_new=0&lt;BR /&gt;for(i=1;i&amp;lt;=numdir;i++) {&lt;BR /&gt;if(p[i]==".") continue&lt;BR /&gt;if(p[i]=="..") {if(ndir_new) {ndir_new--;continue}}&lt;BR /&gt;np[++ndir_new]=p[i]&lt;BR /&gt;}&lt;BR /&gt;if(!ndir_new) return(name)&lt;BR /&gt;new_name=np[1]&lt;BR /&gt;for(i=2;i&amp;lt;=ndir_new;i++) new_name=new_name"/"np[i]&lt;BR /&gt;return(new_name)&lt;BR /&gt;}&lt;BR /&gt;{print pathexp($1)}'&lt;BR /&gt;&lt;BR /&gt;This expects your pathname at stdin.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 28 Jul 2006 08:00:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832832#M100536</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-07-28T08:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: PATH value in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832833#M100537</link>
      <description>Hi,&lt;BR /&gt;you can set your FULL_PATH variable:&lt;BR /&gt;&lt;BR /&gt;FULL_PATH=`cd $MAIN_PATH/;cd $SUPPLEMENTARY_PATH;pwd`&lt;BR /&gt;&lt;BR /&gt;Enrico</description>
      <pubDate>Fri, 28 Jul 2006 08:22:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/path-value-in-a-variable/m-p/3832833#M100537</guid>
      <dc:creator>Enrico P.</dc:creator>
      <dc:date>2006-07-28T08:22:06Z</dc:date>
    </item>
  </channel>
</rss>

