D Shell [was Re: A C++ interpreter]
jerro
a at a.com
Mon Aug 13 22:13:41 PDT 2012
>> cat - test.d <<< "--eval=" | xargs -0 rdmd
>>
>> I've only tried this on Linux.
>
> As a person who's still only half-way a Linux guy, I have to
> ask: What
> the hell is going on in that command?
The minus on the cat command line means standard input and
somecommand <<< "somestring"
Sends "somestring" to the standard input of somecommand. So the
first part here outputs the contents of test.d with --eval=
prepended. That's what xargs get as a standard input. Xargs then
calls rdmd with that string as a command line argument. The -0
flag tells xargs to treat the input as a bunch of zero separated
strings and to treat backslashes and double quotes the same as
other characters (the default is to treat newlines and spaces as
separators and to use quotes and backslashes to prevent spliting
strings on newlines and spaces). I did it that way to avoid
issues with escaping characters.
> I understand bits and pieces of it, but my mind's having a hard
> time
> parsing it. Can any of you unix gurus help me out?
I'm hardly a unix guru, I've been using linux for less than two
years. I guess it's not hard to write hard to read bash commands
:D
More information about the Digitalmars-d
mailing list