<?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: C-Shell Redirection Chicanery in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173914#M90933</link>
    <description>Bourne may be the ancestor of the POSIX standard shells like ksh and bash but outside of HP-UX, the "sh" shell is the primitive Bourne shell which leads to a lot of confusion with new users. The most standard Unix shells today are POSIX-based, with ksh-1988 the most common. HP's POSIX shell is ksh-1988 based (with some enhancements) and HP-UX also supplies ksh-1993, cleverly hidden as /usr/dt/bin/dtksh. BASH is also POSIX compliant  so scripts are highly interchangeable. Probably the most common issue between platforms is with echo and print where echo is often an external command rather than built-in. echo is deprecated in the man page for sh-posix, dtksh and ksh.</description>
    <pubDate>Mon, 07 Apr 2008 02:16:22 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2008-04-07T02:16:22Z</dc:date>
    <item>
      <title>C-Shell Redirection Chicanery</title>
      <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173907#M90926</link>
      <description>&lt;!--!*#--&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;first of all, I must confess that I am not even a casual user of the csh and siblings.&lt;BR /&gt;My surprise when trying to extrapolate from Bourne shell redirection basics seems to endorse my deeply rooted discomfort with this family of shells.&lt;BR /&gt;&lt;BR /&gt;I was asked by a user why, simple stderr suppression by the usual 2&amp;gt;/dev/null idiom, didn't work for him,&lt;BR /&gt;which I first couldn't understand until I noticed that he was using a csh.&lt;BR /&gt;He simply wanted to run a find from / for some file name but didn't want to see the many permission denied messages clutter his output.&lt;BR /&gt;&lt;BR /&gt;A quick glance at the manpage of csh didn't really bring the revelation of a csh equivalent idiom.&lt;BR /&gt;Because when I tried&lt;BR /&gt;&lt;BR /&gt;%&amp;gt; find / -name \*txt &amp;gt;&amp;amp; /dev/null&lt;BR /&gt;&lt;BR /&gt;of course, both stderr as well as stdout were suppressed.&lt;BR /&gt;&lt;BR /&gt;After many surprisingly futile attempts &lt;BR /&gt;I suggested to him to simply stay away from csh for tasks like this and temporarily enter a Bourne shell or run the command in a Bourne subshell.&lt;BR /&gt;&lt;BR /&gt;The closest I got was with a command like this&lt;BR /&gt;&lt;BR /&gt;%&amp;gt; (find / -name \*txt &amp;gt;/tmp/txt-files) &amp;gt;&amp;amp; /dev/null&lt;BR /&gt;&lt;BR /&gt;but this isn't equivalent to&lt;BR /&gt;&lt;BR /&gt;$ find / -name \*txt 2&amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;as it requires tentative storage of results in a file.&lt;BR /&gt;&lt;BR /&gt;I bet there must be a better way which avoids the interim file in csh too.&lt;BR /&gt;Maybe some veteran SunOS user who grew up wih csh could give me a hint?&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Ralph&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Apr 2008 07:38:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173907#M90926</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-04-04T07:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: C-Shell Redirection Chicanery</title>
      <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173908#M90927</link>
      <description>&amp;gt;I must confess that I am not even a casual user of the csh and siblings.&lt;BR /&gt;&lt;BR /&gt;Exactly.  The first thing you should do in the scummy cshell is the "ksh" or "sh" or exit command.  :-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;enter a Bourne shell or run the command in a Bourne subshell.&lt;BR /&gt;&lt;BR /&gt;Don't even think of using Bourne.  Use a real shell, sh or ksh.  The Bourne shell is why I got sucked in the scummy cshell dark side. :-(&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I bet there must be a better way which avoids the interim file in csh too.&lt;BR /&gt;&lt;BR /&gt;I don't think so.  I think your solution was the trick.</description>
      <pubDate>Fri, 04 Apr 2008 08:04:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173908#M90927</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-04T08:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: C-Shell Redirection Chicanery</title>
      <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173909#M90928</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;with Bourne shell I implicitly meant modern Posix shells like HP-UX's standard shell, ksh, bash etc. which all have Bourne shell as ancestor.&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Apr 2008 08:12:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173909#M90928</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-04-04T08:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: C-Shell Redirection Chicanery</title>
      <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173910#M90929</link>
      <description>&amp;gt;which all have Bourne shell as ancestor.&lt;BR /&gt;&lt;BR /&gt;Yes, but if it doesn't have a history mechanism, I won't use it.</description>
      <pubDate>Fri, 04 Apr 2008 08:15:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173910#M90929</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-04T08:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: C-Shell Redirection Chicanery</title>
      <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173911#M90930</link>
      <description>&lt;!--!*#--&gt;I generally use bash these days, but a Google&lt;BR /&gt;search for:&lt;BR /&gt;      csh redirect stderr OR error&lt;BR /&gt;found many things, including ("Feeling&lt;BR /&gt;Lucky"?):&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.faqs.org/faqs/unix-faq/faq/part2/section-9.html" target="_blank"&gt;http://www.faqs.org/faqs/unix-faq/faq/part2/section-9.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;which says:&lt;BR /&gt;&lt;BR /&gt;Date: Mon, 26 Oct 1992 20:15:00 -0500&lt;BR /&gt;&lt;BR /&gt;2.9)  How do I redirect stdout and stderr separately in csh?&lt;BR /&gt;&lt;BR /&gt;      In csh, you can redirect stdout with "&amp;gt;", or stdout and stderr&lt;BR /&gt;      together with "&amp;gt;&amp;amp;" but there is no direct way to redirect stderr&lt;BR /&gt;      only.  The best you can do is&lt;BR /&gt;&lt;BR /&gt;        ( command &amp;gt;stdout_file ) &amp;gt;&amp;amp;stderr_file&lt;BR /&gt;&lt;BR /&gt;      which runs "command" in a subshell;  stdout is redirected inside&lt;BR /&gt;      the subshell to stdout_file, and both stdout and stderr from the&lt;BR /&gt;      subshell are redirected to stderr_file, but by this point stdout&lt;BR /&gt;      has already been redirected so only stderr actually winds up in&lt;BR /&gt;      stderr_file.&lt;BR /&gt;&lt;BR /&gt;      If what you want is to avoid redirecting stdout at all, let sh&lt;BR /&gt;      do it for you.&lt;BR /&gt;&lt;BR /&gt;        sh -c 'command 2&amp;gt;stderr_file'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Boy, this new Inter-Web thing is a miracle.</description>
      <pubDate>Fri, 04 Apr 2008 13:19:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173911#M90930</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-04-04T13:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: C-Shell Redirection Chicanery</title>
      <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173912#M90931</link>
      <description>Hi Steven,&lt;BR /&gt;&lt;BR /&gt;the csh redirection by use of a subshell (viz. using parentheses) was what I also have found out.&lt;BR /&gt;But unlike you I found it the old-fashioned analogue way in my old copy of "Unix in a Nutshell" book (must be from the days when BSD and SunOS was en vogue and everyone used csh).&lt;BR /&gt;I was looking for a pure csh method, other than calling a Bourne shell and passing the command to -c (what I also have suggested to my colleague),&lt;BR /&gt;that would avoid dumping the sought output to a file instead of stdout.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Apr 2008 13:46:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173912#M90931</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-04-04T13:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: C-Shell Redirection Chicanery</title>
      <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173913#M90932</link>
      <description>Hi Ralph:&lt;BR /&gt;&lt;BR /&gt;I can't help pointing you to the classic article by a gentleman whose name is well known to you:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/" target="_blank"&gt;http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Perhaps, some of your co-workers would benefit from reading it.&lt;BR /&gt;&lt;BR /&gt;As for the Bourne shell, a version on HP-UX can be found as '/usr/old/bin/sh'.  The POSIX conformant shell, as you know, is the standard shell and is '/usr/bin/sh' as a dynamically-linked variant with '/sbin/sh' using static linkages for root and single-user mode when '/usr' isn't mounted.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 06 Apr 2008 21:03:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173913#M90932</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-04-06T21:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: C-Shell Redirection Chicanery</title>
      <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173914#M90933</link>
      <description>Bourne may be the ancestor of the POSIX standard shells like ksh and bash but outside of HP-UX, the "sh" shell is the primitive Bourne shell which leads to a lot of confusion with new users. The most standard Unix shells today are POSIX-based, with ksh-1988 the most common. HP's POSIX shell is ksh-1988 based (with some enhancements) and HP-UX also supplies ksh-1993, cleverly hidden as /usr/dt/bin/dtksh. BASH is also POSIX compliant  so scripts are highly interchangeable. Probably the most common issue between platforms is with echo and print where echo is often an external command rather than built-in. echo is deprecated in the man page for sh-posix, dtksh and ksh.</description>
      <pubDate>Mon, 07 Apr 2008 02:16:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173914#M90933</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2008-04-07T02:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: C-Shell Redirection Chicanery</title>
      <link>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173915#M90934</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;many thanks for reminding me of this great article.&lt;BR /&gt;Of course do I know its author from many parts of the Perl installed POD,&lt;BR /&gt;as well as co-author of the famous Perl Cookbook.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Bill,&lt;BR /&gt;&lt;BR /&gt;many thanks too for the short synopsis of POSIX shell revisions.&lt;BR /&gt;For the most part I already abandoned the built-in echo in favour of the more portable printf (especially between HP and Linux where for the latter things like interpolated escape chars like simple \n require the escape option -e for echo)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Apr 2008 10:17:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/c-shell-redirection-chicanery/m-p/4173915#M90934</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-04-07T10:17:35Z</dc:date>
    </item>
  </channel>
</rss>

