<?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 script trick in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920956#M934592</link>
    <description>Hi, I would like to make an alias or script called subdir, which works like : &lt;BR /&gt;&lt;BR /&gt;cd $(find . -type d -name $1 | head -1)&lt;BR /&gt;&lt;BR /&gt;where $1 is the argument representing the directory. &lt;BR /&gt;&lt;BR /&gt;How am I able to communicate this result from the script, or is there another way to get the same effect?</description>
    <pubDate>Thu, 06 Mar 2003 14:17:58 GMT</pubDate>
    <dc:creator>Tore_1</dc:creator>
    <dc:date>2003-03-06T14:17:58Z</dc:date>
    <item>
      <title>script trick</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920956#M934592</link>
      <description>Hi, I would like to make an alias or script called subdir, which works like : &lt;BR /&gt;&lt;BR /&gt;cd $(find . -type d -name $1 | head -1)&lt;BR /&gt;&lt;BR /&gt;where $1 is the argument representing the directory. &lt;BR /&gt;&lt;BR /&gt;How am I able to communicate this result from the script, or is there another way to get the same effect?</description>
      <pubDate>Thu, 06 Mar 2003 14:17:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920956#M934592</guid>
      <dc:creator>Tore_1</dc:creator>
      <dc:date>2003-03-06T14:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: script trick</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920957#M934593</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;A script will not work because it will fork. change directory and then exit back to your local environment without the fork.&lt;BR /&gt;&lt;BR /&gt;Why the script anyway&lt;BR /&gt;&lt;BR /&gt;cd dir is easier.&lt;BR /&gt;&lt;BR /&gt;cd name where name doesnt exist easy error message&lt;BR /&gt;&lt;BR /&gt;A subdir of a directory with the name you want can also comeout . the following is easier in format.&lt;BR /&gt;&lt;BR /&gt;if [ -d $1 ]&lt;BR /&gt;then&lt;BR /&gt;cd $1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Then use the script as . script dir&lt;BR /&gt;&lt;BR /&gt;to avoid the fork&lt;BR /&gt;&lt;BR /&gt;An alias will not work because you cannot setup a parameter to pass easily.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;          steve Steel&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Mar 2003 14:30:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920957#M934593</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2003-03-06T14:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: script trick</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920958#M934594</link>
      <description>I know this.&lt;BR /&gt;&lt;BR /&gt;subdir should be more than one level down.</description>
      <pubDate>Thu, 06 Mar 2003 14:41:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920958#M934594</guid>
      <dc:creator>Tore_1</dc:creator>
      <dc:date>2003-03-06T14:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: script trick</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920959#M934595</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;A workaround is to define it as a function in your .profile.&lt;BR /&gt;&lt;BR /&gt;subdir()&lt;BR /&gt;{&lt;BR /&gt;if [ $# != 1 ]&lt;BR /&gt;then&lt;BR /&gt;echo "usage $0: subdirectory"&lt;BR /&gt;break&lt;BR /&gt;else&lt;BR /&gt;cd $(find . -type d -name $1 | head -1) &lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 06 Mar 2003 14:55:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920959#M934595</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2003-03-06T14:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: script trick</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920960#M934596</link>
      <description>Hi Tore,&lt;BR /&gt;&lt;BR /&gt;one way would be to put the following in a script...&lt;BR /&gt;&lt;BR /&gt;alias changedir="cd `find . -type d -name $1|head -1`"&lt;BR /&gt;&lt;BR /&gt;...run the script by typing...&lt;BR /&gt;&lt;BR /&gt;. ./scriptname&lt;BR /&gt;&lt;BR /&gt;...then enter "changedir" to change directory.&lt;BR /&gt;&lt;BR /&gt;Gary.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Mar 2003 15:15:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-trick/m-p/2920960#M934596</guid>
      <dc:creator>gary phipps</dc:creator>
      <dc:date>2003-03-06T15:15:33Z</dc:date>
    </item>
  </channel>
</rss>

