<?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: Script commands in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455685#M12418</link>
    <description>Bach:&lt;BR /&gt;&lt;BR /&gt;You can try:&lt;BR /&gt;&lt;BR /&gt;FULL_PATH=/path1/path2/file&lt;BR /&gt;&lt;BR /&gt;echo $FULL_PATH | awk -F/  '{ printf "filename is" $(NF) "nPath is: " } { for (i = 2 ; i &amp;lt; NF; i++) printf $(i) }'   &lt;BR /&gt;&lt;BR /&gt;make changes as required</description>
    <pubDate>Thu, 19 Oct 2000 16:53:10 GMT</pubDate>
    <dc:creator>Kofi ARTHIABAH</dc:creator>
    <dc:date>2000-10-19T16:53:10Z</dc:date>
    <item>
      <title>Script commands</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455680#M12413</link>
      <description>I need some help to identify the filename and the associated pathname that the users&lt;BR /&gt;input when executing a script.&lt;BR /&gt;Suppose the users input two following files:&lt;BR /&gt;/path1/path2/path3/file1    and&lt;BR /&gt;/path1/path2/file2&lt;BR /&gt;Now, what command can I use to retrieve just&lt;BR /&gt;the file name and the pathname itself?&lt;BR /&gt;/path1/path2/path3 and file1&lt;BR /&gt;/path1/path2 and file2&lt;BR /&gt;TIA.</description>
      <pubDate>Thu, 19 Oct 2000 16:22:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455680#M12413</guid>
      <dc:creator>bhoang</dc:creator>
      <dc:date>2000-10-19T16:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script commands</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455681#M12414</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Use 'basename' to get the filename.  Use 'dirname' to get the directory name.  See man pages for 'basename'.&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;dirname /usr/src/cmd/cat.c&lt;BR /&gt;&lt;BR /&gt;returns /usr/src/cmd&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;This  &lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 19 Oct 2000 16:30:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455681#M12414</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-10-19T16:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script commands</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455682#M12415</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Use 'basename' to get the filename.  Use 'dirname' to get the directory name.  See man pages for 'basename'.&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;dirname /usr/src/cmd/cat.c&lt;BR /&gt;&lt;BR /&gt;returns: /usr/src/cmd&lt;BR /&gt;&lt;BR /&gt;basename /usr/src/cmd/cat.c&lt;BR /&gt;&lt;BR /&gt;returns: cat.c&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 19 Oct 2000 16:32:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455682#M12415</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-10-19T16:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Script commands</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455683#M12416</link>
      <description>You can use the next command s in your script&lt;BR /&gt;basename $0&lt;BR /&gt;dirname $0&lt;BR /&gt;&lt;BR /&gt;refer to man page of basename command for additional information</description>
      <pubDate>Thu, 19 Oct 2000 16:33:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455683#M12416</guid>
      <dc:creator>Vladislav Demidov</dc:creator>
      <dc:date>2000-10-19T16:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Script commands</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455684#M12417</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Are you trying to split a filename into the directory part and the file part?&lt;BR /&gt;&lt;BR /&gt;If so then you can do it as follows:-&lt;BR /&gt;&lt;BR /&gt;#/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;FN=/path1/path2/path3/file&lt;BR /&gt;FILE=${FN##*/}&lt;BR /&gt;DIR=${FN%/*}&lt;BR /&gt;&lt;BR /&gt;The FILE= construct removes all characters up to the final / leaving 'file'&lt;BR /&gt;&lt;BR /&gt;The DIR= construct removes the final / and everything after it, leaving '/path1/path2/path3'&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;John</description>
      <pubDate>Thu, 19 Oct 2000 16:33:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455684#M12417</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2000-10-19T16:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script commands</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455685#M12418</link>
      <description>Bach:&lt;BR /&gt;&lt;BR /&gt;You can try:&lt;BR /&gt;&lt;BR /&gt;FULL_PATH=/path1/path2/file&lt;BR /&gt;&lt;BR /&gt;echo $FULL_PATH | awk -F/  '{ printf "filename is" $(NF) "nPath is: " } { for (i = 2 ; i &amp;lt; NF; i++) printf $(i) }'   &lt;BR /&gt;&lt;BR /&gt;make changes as required</description>
      <pubDate>Thu, 19 Oct 2000 16:53:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-commands/m-p/2455685#M12418</guid>
      <dc:creator>Kofi ARTHIABAH</dc:creator>
      <dc:date>2000-10-19T16:53:10Z</dc:date>
    </item>
  </channel>
</rss>

