zsh-users
 help / color / mirror / code / Atom feed
* [Newbie] 'set|grep' doesn't work as expected
@ 2002-05-24 23:27 Thiago F.G.Albuquerque
  2002-05-25  0:09 ` Phil Pennock
  0 siblings, 1 reply; 8+ messages in thread
From: Thiago F.G.Albuquerque @ 2002-05-24 23:27 UTC (permalink / raw)
  To: zsh-users

Hi,

In bash I can type

set | grep <something>

and it's ok.

In zsh, it gives me the message:

Binary file (standard input) matches

Why?

Thiago


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Newbie] 'set|grep' doesn't work as expected
  2002-05-25  0:09 ` Phil Pennock
@ 2002-05-24 23:59   ` Preben Peppe Guldberg
  2002-05-25  0:47     ` Phil Pennock
  2002-05-25 21:45     ` Thiago F.G. Albuquerque
  0 siblings, 2 replies; 8+ messages in thread
From: Preben Peppe Guldberg @ 2002-05-24 23:59 UTC (permalink / raw)
  To: zsh-users; +Cc: Thiago F. G. Albuquerque

Således berettede Phil Pennock (Phil.Pennock@globnix.org) den [020525]:
> On 2002-05-24 at 20:27 -0300, Thiago F. G. Albuquerque wrote:
> > In bash I can type

> > set | grep <something>

> > and it's ok.

> > In zsh, it gives me the message:

> > Binary file (standard input) matches

> > Why?

> Because you have something in the environment with a non-plaintext
> representation.

I think that would be IFS. In bash the default is <space><tab><newline>,
while zsh add <nul> to these.

Peppe
-- 
                                      "Before you criticize someone, walk
Preben "Peppe" Guldberg  __/-\__       a mile in his shoes. That way, if
c928400@student.dtu.dk    (o o)        he gets angry, he'll be a mile away
----------------------oOOo (_) oOOo--  - and barefoot."    --Sarah Jackson


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Newbie] 'set|grep' doesn't work as expected
  2002-05-24 23:27 [Newbie] 'set|grep' doesn't work as expected Thiago F.G.Albuquerque
@ 2002-05-25  0:09 ` Phil Pennock
  2002-05-24 23:59   ` Preben Peppe Guldberg
  0 siblings, 1 reply; 8+ messages in thread
From: Phil Pennock @ 2002-05-25  0:09 UTC (permalink / raw)
  To: Thiago F. G. Albuquerque; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

On 2002-05-24 at 20:27 -0300, Thiago F. G. Albuquerque wrote:
> In bash I can type
> 
> set | grep <something>
> 
> and it's ok.
> 
> In zsh, it gives me the message:
> 
> Binary file (standard input) matches
> 
> Why?

Because you have something in the environment with a non-plaintext
representation.

Perhaps: export foo="$(print '\efred')"

It could be that you've even inherited a key=value pair where the key is
the problem.  But zsh itself won't let you set such.

Perhaps you have UTF or ISO 8859 data in a string and your grep doesn't
know about the local.

If your grep supports the "-a" option, to force interpretation as ASCII,
perhaps you could try that.

Or track down _why_ you have strange values in your environment.


If this is at all related to your use of zsh vs bash, then you've put
binary data into the environment in one of your zsh startup files.
-- 
I just felt a great disturbance in the net, as if millions of packets
suddenly cried out in terror, and were suddenly discarded. -- amt

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Newbie] 'set|grep' doesn't work as expected
  2002-05-24 23:59   ` Preben Peppe Guldberg
@ 2002-05-25  0:47     ` Phil Pennock
  2002-05-25  3:19       ` Dan Nelson
  2002-05-25 21:45     ` Thiago F.G. Albuquerque
  1 sibling, 1 reply; 8+ messages in thread
From: Phil Pennock @ 2002-05-25  0:47 UTC (permalink / raw)
  To: Preben Peppe Guldberg, zsh-users, Thiago F. G. Albuquerque

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

On 2002-05-25 at 01:59 +0200, Preben Peppe Guldberg wrote:
> Således berettede Phil Pennock (Phil.Pennock@globnix.org) den [020525]:
> > Because you have something in the environment with a non-plaintext
> > representation.
> 
> I think that would be IFS. In bash the default is <space><tab><newline>,
> while zsh add <nul> to these.

Uhm, why are you routinely exporting IFS to your environment?
-- 
It's never too late to have a happy childhood.

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Newbie] 'set|grep' doesn't work as expected
  2002-05-25  0:47     ` Phil Pennock
@ 2002-05-25  3:19       ` Dan Nelson
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Nelson @ 2002-05-25  3:19 UTC (permalink / raw)
  To: Preben Peppe Guldberg, zsh-users, Thiago F. G. Albuquerque

In the last episode (May 25), Phil Pennock said:
> On 2002-05-25 at 01:59 +0200, Preben Peppe Guldberg wrote:
> > Sσledes berettede Phil Pennock (Phil.Pennock@globnix.org) den [020525]:
> > > Because you have something in the environment with a non-plaintext
> > > representation.
> > 
> > I think that would be IFS. In bash the default is <space><tab><newline>,
> > while zsh add <nul> to these.
> 
> Uhm, why are you routinely exporting IFS to your environment?

Set shows all variables, exported and local.

-- 
	Dan Nelson
	dnelson@allantgroup.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Newbie] 'set|grep' doesn't work as expected
  2002-05-24 23:59   ` Preben Peppe Guldberg
  2002-05-25  0:47     ` Phil Pennock
@ 2002-05-25 21:45     ` Thiago F.G. Albuquerque
  2002-05-26  6:39       ` Borsenkow Andrej
  1 sibling, 1 reply; 8+ messages in thread
From: Thiago F.G. Albuquerque @ 2002-05-25 21:45 UTC (permalink / raw)
  To: zsh-users

Preben Peppe Guldberg wrote:

> Således berettede Phil Pennock (Phil.Pennock@globnix.org) den [020525]:
> 
>>On 2002-05-24 at 20:27 -0300, Thiago F. G. Albuquerque wrote:
>>
>>>In bash I can type
>>>
> 
>>>set | grep <something>
>>>
> 
>>>and it's ok.
>>>
> 
>>>In zsh, it gives me the message:
>>>
> 
>>>Binary file (standard input) matches
>>>
> 
>>>Why?
>>>
> 
>>Because you have something in the environment with a non-plaintext
>>representation.
>>
> 
> I think that would be IFS. In bash the default is <space><tab><newline>,
> while zsh add <nul> to these.


You're right. Look:

1 ~> echo $IFS | dump
0000  20  9  A  0  A                                     .....

This is <space>, '\t', '\n' and '\0'. The last "A" is the '\n' printed by echo.

In bash, IFS is set to nothing.

I unset IFS in zsh and "set|grep" worked again.
Using "grep -a" also works.

Is it ok if I remove \0 from IFS?

I would like to thank everybody who replied to my message. Thank you.

Thiago


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Newbie] 'set|grep' doesn't work as expected
  2002-05-25 21:45     ` Thiago F.G. Albuquerque
@ 2002-05-26  6:39       ` Borsenkow Andrej
  2002-05-27  5:53         ` Borsenkow Andrej
  0 siblings, 1 reply; 8+ messages in thread
From: Borsenkow Andrej @ 2002-05-26  6:39 UTC (permalink / raw)
  To: Thiago F.G. Albuquerque; +Cc: zsh-users

В Вск, 26.05.2002, в 01:45, Thiago F.G. Albuquerque написал:
> You're right. Look:
> 
> 1 ~> echo $IFS | dump
> 0000  20  9  A  0  A                                     .....
> 
> This is <space>, '\t', '\n' and '\0'. The last "A" is the '\n' printed by echo.
> 
> In bash, IFS is set to nothing.
> 

Impossible (unless you either unset it yourself or have very broken
version). (Value of) IFS is used to split input line into words in some
contexts; I am sure about `read' builtin and possibly some others
(select?). By default it is set to space, TAB and LF for sure; I am not
sure if \0 is Zsh extension (anybody cares to lookup in SUS?)

> I unset IFS in zsh and "set|grep" worked again.
> Using "grep -a" also works.
> 
> Is it ok if I remove \0 from IFS?
> 

Zsh itself does not depend on its value. But you may have some scripts
that expect it to contain \0. 

-andrej


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [Newbie] 'set|grep' doesn't work as expected
  2002-05-26  6:39       ` Borsenkow Andrej
@ 2002-05-27  5:53         ` Borsenkow Andrej
  0 siblings, 0 replies; 8+ messages in thread
From: Borsenkow Andrej @ 2002-05-27  5:53 UTC (permalink / raw)
  To: 'Thiago F.G. Albuquerque'; +Cc: zsh-users

Ю В Вскб 26ю05ю2002б в 01Ж45б Ершфпщ АюПю Фдигйгукйгу написалЖ
> > You're right. Look:
> >
> > 1 ~> echo $IFS | dump
> > 0000  20  9  A  0  A                                     .....
> >
> > This is <space>, '\t', '\n' and '\0'. The last "A" is the '\n'
printed by
> echo.
> >
> > In bash, IFS is set to nothing.
> >
> 
> Impossible (unless you either unset it yourself or have very broken
> version). (Value of) IFS is used to split input line into words in
some
> contexts; I am sure about `read' builtin and possibly some others
> (select?). By default it is set to space, TAB and LF for sure; I am
not
> sure if \0 is Zsh extension (anybody cares to lookup in SUS?)
> 

For the record - neither SUS V2 nor SUS V3 specify default IFS value.
The only statement is, if IFS is not defined shell behaves as if it
contains space, TAB and NL.

-andrej


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-05-27  5:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-24 23:27 [Newbie] 'set|grep' doesn't work as expected Thiago F.G.Albuquerque
2002-05-25  0:09 ` Phil Pennock
2002-05-24 23:59   ` Preben Peppe Guldberg
2002-05-25  0:47     ` Phil Pennock
2002-05-25  3:19       ` Dan Nelson
2002-05-25 21:45     ` Thiago F.G. Albuquerque
2002-05-26  6:39       ` Borsenkow Andrej
2002-05-27  5:53         ` Borsenkow Andrej

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).