Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Why does this code works without cat ?

Reply
Thread Tools

Why does this code works without cat ?

 
 
Eric Pozharski
Guest
Posts: n/a
 
      04-25-2012
with <jn6crp$3ed$(E-Mail Removed)> Tim McDaniel wrote:
> In article <(E-Mail Removed)>,
> Eric Pozharski <(E-Mail Removed)> wrote:
>>with <(E-Mail Removed)> Ben Morrow wrote:


>>> foo 3>&2 2>&1 >&3 3>&- | bar

>>
>>Wait a second. If that thread would have anything like a goal-post,
>>that would clearly constitute goal-post moving. All that in skipped
>>had nothing to do with redirecting *output*. We were talking
>>redirecting input.

> I'm sorry. I had not realized that we're not allow to discuss
> redirecting output. Thank you for clarifying.


You understand difference between redirecting *one* input stream and
redirecting *two* output streams, don't you?

*CUT* [[ 'wc' is meta-syntactic, just like above ]]

--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom
 
Reply With Quote
 
 
 
 
Eric Pozharski
Guest
Posts: n/a
 
      04-26-2012
with <(E-Mail Removed)> Ben Morrow wrote:
> Quoth Eric Pozharski <(E-Mail Removed)>:

*SKIP*
>> The only reason for this could be POSIX. Any reference, please?

> Well, if you insist:

*SKIP*

I have to read it around. In order to lay hands on this I have to
register, what will take some time. Maybe some kind soul would point to
some pirated copy, but I guess not.

*SKIP* [[ no reason to quote unparsable ]]
> I can't parse either of those paragraphs. In any case, this has nothing
> whatever to do with bash: this is the way shish shells have behaved
> since the Bourne shell.


Right. There's no need to implement a feature that noone uses. Noone
uses a feature because it's not implemented. zsh still wins.

--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom
 
Reply With Quote
 
 
 
 
Rainer Weikusat
Guest
Posts: n/a
 
      04-26-2012
Eric Pozharski <(E-Mail Removed)> writes:
> with <(E-Mail Removed)> Ben Morrow wrote:
>> Quoth Eric Pozharski <(E-Mail Removed)>:

> *SKIP*
>>> The only reason for this could be POSIX. Any reference, please?

>> Well, if you insist:

> *SKIP*
>
> I have to read it around. In order to lay hands on this I have to
> register, what will take some time. Maybe some kind soul would point to
> some pirated copy, but I guess not.


Since the UNIX(*) standard is available for free (except that you
have to register), I doubt that someone would want to 'pirate' it ...
 
Reply With Quote
 
Peter J. Holzer
Guest
Posts: n/a
 
      04-28-2012
On 2012-04-26 19:35, Ben Morrow <(E-Mail Removed)> wrote:
> More generally, if the extension had used syntax which was previously
> invalid, like the similar N<(cmd args) extension implemented by both zsh
> and bash (but not ksh), there would have been no problem. In this case,
> though, the syntax chosen *was* previously valid sh syntax, so zsh's
> designers should have realised someone somewhere was probably using it
> with its sh meaning, and chosen something else.


They probably did realize that and didn't care. The zsh is not intended
to be bourne shell compatible. It started as "mostly bourne shell, but
with the good parts of csh mixed in" and grew from there. There are
other differences, too - for example parameter expansion differs
significantly from the bourne shell - not by mistake, but because the
zsh developers considered the bourne shell broken in this regard and
decided to fix it. (The POSIX shell can never fix that - it must remain
backwards compatible)

hp


--
_ | Peter J. Holzer | Deprecating human carelessness and
|_|_) | Sysadmin WSR | ignorance has no successful track record.
| | | http://www.velocityreviews.com/forums/(E-Mail Removed) |
__/ | http://www.hjp.at/ | -- Bill Code on (E-Mail Removed)
 
Reply With Quote
 
Peter J. Holzer
Guest
Posts: n/a
 
      04-28-2012
On 2012-04-26 10:23, Eric Pozharski <(E-Mail Removed)> wrote:
> with <(E-Mail Removed)> Ben Morrow wrote:
>> Quoth Eric Pozharski <(E-Mail Removed)>:

> *SKIP*
>>> The only reason for this could be POSIX. Any reference, please?

>> Well, if you insist:

> *SKIP*
>
> I have to read it around. In order to lay hands on this I have to
> register, what will take some time. Maybe some kind soul would point to
> some pirated copy, but I guess not.


Try this link: http://pubs.opengroup.org/onlinepubs/9699919799/toc.htm

Not pirated, just a deep link.

hp


--
_ | Peter J. Holzer | Deprecating human carelessness and
|_|_) | Sysadmin WSR | ignorance has no successful track record.
| | | (E-Mail Removed) |
__/ | http://www.hjp.at/ | -- Bill Code on (E-Mail Removed)
 
Reply With Quote
 
Eric Pozharski
Guest
Posts: n/a
 
      04-29-2012
with <(E-Mail Removed)> Peter J. Holzer wrote:

*SKIP*
> Try this link: http://pubs.opengroup.org/onlinepubs/9699919799/toc.htm
>
> Not pirated, just a deep link.


Thank you kind soul for this pirated copy! Already reading.

As of registration, I guess, I've failed just as two years ago. I must
be from an "organisation". And I'm not.

--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom
 
Reply With Quote
 
Eric Pozharski
Guest
Posts: n/a
 
      05-02-2012
with <(E-Mail Removed)> Ben Morrow wrote:
> Quoth Eric Pozharski <(E-Mail Removed)>:


*SKIP*
>> The only reason for this could be POSIX. Any reference, please?

> Well, if you insist:


>| If more than one redirection operator is specified with a command,
>| the order of evaluation is from beginning to end.
>|
>| A failure to open or create a file shall cause a redirection to fail.
>|
>| 2.7.1 Redirecting Input
>|
>| Input redirection shall cause the file whose name results from the
>| expansion of word to be opened for reading on the designated file
>| descriptor, or standard input if the file descriptor is not
>| specified.


After reading and further research I must admit that's the only relevant
part. Now I can say, that bash-people and zsh-people read that
differently. POSIX, at least four years ago, says nothing what to do if
one FD is redirected more than once. "the order of evaluation is from
beginning to end" doesn't suppose that what's already evaluated should
be dropped. I've got to conclusion (and I'm not interested in
discussing this with bash-people) that both shells, bash and zsh, are
POSIX compliant.

However, I dare to comment a bit more. There're three concurent ways to
maintain STDIN for commands.

First, what cat(1) does, in essence, is turning files into clean
bytestream. OTOH, there's that puristic proverb about
useless-use-of-cat. And that proverb is mantra. Tell me, shell
wizards, what is more pure:

cat filename | grep word

or

grep -h word filename

And all that bytestream BS is relevant as long as cat(1) is fed with
filenames. Because,

Second comes redirection. It has bonuses, but (I stand corrected) it
comes with price. And that price is so huge that it renders redirection
useless. Isn't this elegant:

cat <<<"### /etc/hosts.allow ###" /etc/hosts.allow \
<<<"### /etc/hosts.deny ###" /etc/hosts.deny | lp

It's not, because it's not portable. What we have here is bash sneaking
it's features and limitations under disguise of compatibility. Good
news is that shell is so long forgotten that it doesn't harm anyone
anymore.

Third is command line tail. Well, we're supposedly talking Perl here,
it's an *interpreted* script, I can do whatever I want with that script.
I just need filenames.

Shortly, zsh wins, bash is lame, we all lose, and now I feel much better.

*CUT*

--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
GBIC moved from Cat 3508 --> Cat 6513 shows wrong media type Hoffa Cisco 14 09-21-2006 04:25 AM
Cat 5 vs Cat 6 =?Utf-8?B?Unlhbg==?= Wireless Networking 1 04-21-2006 04:18 AM
Cat 6500 to Cat 6500 and VLANs Gary Cisco 2 12-02-2005 06:57 AM



Advertisments