On 9/5/05, Bill Kelly <billk / cts.com> wrote:
> From: "Dave Burt" <dave / burt.id.au>
>> Bill Kelly wrote:
>>> Its commands don't output information in ways that facilitate
>>> being piped together.
>> You can get native ports for most of these GNU utils to Windows; I
>> use these heaps. It's not a shell issue at all.
> I had in mind 'dir' and the headers and footers it outputs, which is a
> built-in command to cmd.exe, is it not? But sorry for generalizing.
> As I mentioned I use the Cygwin GNU tools, even if under cmd.exe.
>
>>> <snip vitriol>
> Just to clarify, it wasn't directed at Austin, but MS-DOS. :)
>
> I'd stand by the hypothesis that the way the built-in 'dir' command
> works is a symptom of the general lack of focus on program
> interoperability that pervades MS-DOS.
>
> More cmd.exe fun:
> How to invoke one program and use its output in the command line?
> Ex: HOME=`pwd | cut -d/ -f1-4`
Can't do that, as far as I can see, but that may just be where my
knowledge is sometimes limited. However, what you would want might be:
SET HOME=%CD:~0,-5%
It's not *quite* the same (as cut uses fields), but you might also be
able to do something with SET /A.
> Being able to invoke sub-shells on the command line would be nice.
> Ex: ( tar cf - /home ) | ( cd /mnt/backup; tar xvfp - )
C:\>(echo hello & echo hello2) && (echo goodbye & echo goodbye2)
hello
hello2
goodbye
goodbye2
I haven't got tar, etc. so I can't test the specific case. But as with
your next item (e.g., 2>&1), this is *built in*.
> How to flexibly redirect output streams?
> Ex: 2>&1
Exactly that.
This is part of the reason I get so damned frustrated when people slag
on cmd.exe. Most people do NOT know what is possible with cmd.exe -- and
they don't bother to find out. Then you have people like Charles Plager
who are so blinkered by their bigotry that they can't even see it.
-austin
--
Austin Ziegler * halostatue / gmail.com
* Alternate: austin / halostatue.ca