<?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: alias command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/alias-command/m-p/2416098#M764790</link>
    <description>Anthony's suggestion is a good one at first glance, but unfortunately this &lt;BR /&gt;doesn't work :)  The $1 variable is not set when the alias command is executed, &lt;BR /&gt;so you end up with cd being aliased to "cd ; ls". This will cause any cd &lt;BR /&gt;command to jump to your home directory and then do an ls. The Korn shell &lt;BR /&gt;doesn't give you any warning that this won't work, but the Posix shell does by &lt;BR /&gt;reporting "sh: 1: Parameter not set."&lt;BR /&gt;&lt;BR /&gt;The only way I know to do what is wanted here is to use a function. Just add &lt;BR /&gt;the following to your .kshrc or other shell startup script. Keep in mind that &lt;BR /&gt;if you want it to happen in your CDE terminal windows, you'll need to set CDE &lt;BR /&gt;up to source your regular profiles, or ad these lines to your .dtprofile:&lt;BR /&gt;&lt;BR /&gt;  function cdl&lt;BR /&gt;  {&lt;BR /&gt;    cd $1&lt;BR /&gt;    ls&lt;BR /&gt;  }&lt;BR /&gt;  alias cd=cdl&lt;BR /&gt;&lt;BR /&gt;This will create the cdl function, which will do whatever is inside the braces. &lt;BR /&gt;Make sure you put the  alias command after the function. If you put it first, &lt;BR /&gt;it runs into a loop of some sort and doesn't work (because cd = cdl before the &lt;BR /&gt;function uses it I guess).&lt;BR /&gt;&lt;BR /&gt;The only problem with this simple of a function is that if you give it an &lt;BR /&gt;invalid directory, it will give an error and then list the current directory, &lt;BR /&gt;often scrolling the error off the screen. You may want to add some error &lt;BR /&gt;checking to your function.</description>
    <pubDate>Wed, 17 Nov 1999 15:59:43 GMT</pubDate>
    <dc:creator>Dan Hull</dc:creator>
    <dc:date>1999-11-17T15:59:43Z</dc:date>
    <item>
      <title>alias command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/alias-command/m-p/2416096#M764788</link>
      <description>I'm trying to create an alias that will list the files in a directory when you &lt;BR /&gt;cd to it.  I have used the command&lt;BR /&gt;&lt;BR /&gt;alias cd="cd \!* ; ls"&lt;BR /&gt;&lt;BR /&gt;on other systems.  But the HP I'm using doesn't seem to recognize the \!* as a &lt;BR /&gt;way to imput characters typed in as arguments in the command line.  Do I just &lt;BR /&gt;have a syntax error or is this not supported.  I cann't find it referenced in &lt;BR /&gt;any of my documentation.&lt;BR /&gt;&lt;BR /&gt;I'm running 10.20, Korn shell.  &lt;BR /&gt;</description>
      <pubDate>Wed, 17 Nov 1999 14:21:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/alias-command/m-p/2416096#M764788</guid>
      <dc:creator>wes glanz</dc:creator>
      <dc:date>1999-11-17T14:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: alias command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/alias-command/m-p/2416097#M764789</link>
      <description>You may find that you used &lt;BR /&gt;&lt;BR /&gt;alias cd "cd \!* ; ls"&lt;BR /&gt;&lt;BR /&gt;on csh/tcsh or a variant if you are using Ksh try something like the following&lt;BR /&gt;&lt;BR /&gt;alias cd="cd $1; ls"&lt;BR /&gt;&lt;BR /&gt;as "cd" only gets one ARG passed to it you should be safe with the $1.&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Nov 1999 15:24:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/alias-command/m-p/2416097#M764789</guid>
      <dc:creator>Anthony Goonetilleke_1</dc:creator>
      <dc:date>1999-11-17T15:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: alias command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/alias-command/m-p/2416098#M764790</link>
      <description>Anthony's suggestion is a good one at first glance, but unfortunately this &lt;BR /&gt;doesn't work :)  The $1 variable is not set when the alias command is executed, &lt;BR /&gt;so you end up with cd being aliased to "cd ; ls". This will cause any cd &lt;BR /&gt;command to jump to your home directory and then do an ls. The Korn shell &lt;BR /&gt;doesn't give you any warning that this won't work, but the Posix shell does by &lt;BR /&gt;reporting "sh: 1: Parameter not set."&lt;BR /&gt;&lt;BR /&gt;The only way I know to do what is wanted here is to use a function. Just add &lt;BR /&gt;the following to your .kshrc or other shell startup script. Keep in mind that &lt;BR /&gt;if you want it to happen in your CDE terminal windows, you'll need to set CDE &lt;BR /&gt;up to source your regular profiles, or ad these lines to your .dtprofile:&lt;BR /&gt;&lt;BR /&gt;  function cdl&lt;BR /&gt;  {&lt;BR /&gt;    cd $1&lt;BR /&gt;    ls&lt;BR /&gt;  }&lt;BR /&gt;  alias cd=cdl&lt;BR /&gt;&lt;BR /&gt;This will create the cdl function, which will do whatever is inside the braces. &lt;BR /&gt;Make sure you put the  alias command after the function. If you put it first, &lt;BR /&gt;it runs into a loop of some sort and doesn't work (because cd = cdl before the &lt;BR /&gt;function uses it I guess).&lt;BR /&gt;&lt;BR /&gt;The only problem with this simple of a function is that if you give it an &lt;BR /&gt;invalid directory, it will give an error and then list the current directory, &lt;BR /&gt;often scrolling the error off the screen. You may want to add some error &lt;BR /&gt;checking to your function.</description>
      <pubDate>Wed, 17 Nov 1999 15:59:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/alias-command/m-p/2416098#M764790</guid>
      <dc:creator>Dan Hull</dc:creator>
      <dc:date>1999-11-17T15:59:43Z</dc:date>
    </item>
  </channel>
</rss>

