zsh-users
 help / color / mirror / code / Atom feed
* Porting an alias from bash to zsh fails.
@ 2004-10-23 21:52 s. keeling
       [not found] ` <m3mzyd6pzp.fsf@asfast.com>
  0 siblings, 1 reply; 7+ messages in thread
From: s. keeling @ 2004-10-23 21:52 UTC (permalink / raw)
  To: zsh-users

Hi list.  I'm new to zsh so this could well be pretty simple.  I've
been wondering why the following works in bash, but fails miserably in
zsh.  I've tried stuffing the font into an ENV variable, I've replaced the
double quotes with single ticks, I've inserted a "\" before the
embedded space char, and I've used the real font name (not the ENV
var) in the alias itself, all to no avail.  What am I missing here?

   RXVTNEWSFONT='-*-neep alt-medium-*-normal-*-*-100-75-75-c-*-iso8859-1'

   alias dfn="rxvt +sb -fn $RXVTNEWSFONT -geometry 128x51+69+42 \
      -e nice /usr/bin/slrn -f /home/keeling/.jnewsrc-dfn \
      -h news.individual.net"

[That alias line is really all on one line without the "\"'s.]
Running "dfn &" in zsh says:

   ------------------------------------------------
(0) keeling /home/keeling_ dfn &
[1] 24158
(0) keeling /home/keeling_ zsh: no matches found: -*-neep alt-medium-*-normal-*-*-100-75-75-c-*-iso8859-1

[1]  + exit 1     rxvt +sb -fn -*-neep\ alt-medium-*-normal-*-*-100-75-75-c-*-iso8859-1   -e   
   ------------------------------------------------

Thanks.


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)               http://www.spots.ab.ca/~keeling 
- -


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

* Re: Porting an alias from bash to zsh fails.
       [not found] ` <m3mzyd6pzp.fsf@asfast.com>
@ 2004-10-23 23:14   ` s. keeling
  2004-10-24  4:09     ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: s. keeling @ 2004-10-23 23:14 UTC (permalink / raw)
  To: zsh-users

Incoming from Lloyd Zusman:
> "s. keeling" <keeling@spots.ab.ca> writes:
> > 
> >    RXVTNEWSFONT='-*-neep alt-medium-*-normal-*-*-100-75-75-c-*-iso8859-1'
> >
> >    alias dfn="rxvt +sb -fn $RXVTNEWSFONT -geometry 128x51+69+42 \
> >       -e nice /usr/bin/slrn -f /home/keeling/.jnewsrc-dfn \
> >       -h news.individual.net"
> [snip]
> To protect this from occurring, put single quotes around that variable
> in the alias definition:
> 
>    alias dfn="rxvt +sb -fn '$RXVTNEWSFONT' -geometry 128x51+69+42 \
>       -e nice /usr/bin/slrn -f /home/keeling/.jnewsrc-dfn \
>       -h news.individual.net"
> [snip]
> 
> This works because the single quotes are treated as normal (non-quoting)
.....................^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> characters when inside of double quotes; therefore, the RXVTNEWSFONT
..^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

That was a surprise to me.  Thanks.  Your excellent explanation has
solved it for me.  Much appreciated.


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)               http://www.spots.ab.ca/~keeling 
- -


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

* Re: Porting an alias from bash to zsh fails.
  2004-10-23 23:14   ` s. keeling
@ 2004-10-24  4:09     ` Bart Schaefer
  2004-10-24  4:25       ` Lloyd Zusman
  2004-10-24  4:51       ` s. keeling
  0 siblings, 2 replies; 7+ messages in thread
From: Bart Schaefer @ 2004-10-24  4:09 UTC (permalink / raw)
  To: s. keeling; +Cc: zsh-users

On Sat, 23 Oct 2004, s. keeling wrote:

> Hi list.  I'm new to zsh so this could well be pretty simple.  I've been 
> wondering why the following works in bash, but fails miserably in zsh.

It's almost certainly because the default setting of the NO_MATCH option
is reversed in the two shells.  In bash, by default, when a glob doesn't
match anything, the pattern is left unexpanded, but in zsh by default it
generates the "no matches" error.

> What am I missing here?

>    RXVTNEWSFONT='-*-neep alt-medium-*-normal-*-*-100-75-75-c-*-iso8859-1'
> 
>    alias dfn="rxvt +sb -fn $RXVTNEWSFONT -geometry 128x51+69+42 \
>       -e nice /usr/bin/slrn -f /home/keeling/.jnewsrc-dfn \
>       -h news.individual.net"

This one would have worked for you if only you'd put the entire thing in
single quotes instead of double quotes.  There's no reason to expand the
variable at the time the alias is defined; let it be expanded (and thus
not globbed) at the time the alias is _used_.  This has the added benefit
that you can change the value of the variable to change the font used by
the alias, without having to redefine the alias again.

On Sat, 23 Oct 2004, s. keeling wrote:

> Incoming from Lloyd Zusman:
> >    alias dfn="rxvt +sb -fn '$RXVTNEWSFONT' -geometry 128x51+69+42 \
> >       -e nice /usr/bin/slrn -f /home/keeling/.jnewsrc-dfn \
> >       -h news.individual.net"
> > [snip]
> > 
> > This works because the single quotes are treated as normal (non-quoting)
> .....................^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > characters when inside of double quotes; therefore, the RXVTNEWSFONT
> ..^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> That was a surprise to me.  Thanks.  Your excellent explanation has
> solved it for me.  Much appreciated.

Lloyd's suggestion works in this case, but it would fail in the event that
the value of the variable contained any single-quote characters.  A better
solution would be to swap the single and double quotes:

alias dfn='rxvt +sb -fn "$RXVTNEWSFONT" -geometry 128x51+69+42 ...'


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

* Re: Porting an alias from bash to zsh fails.
  2004-10-24  4:09     ` Bart Schaefer
@ 2004-10-24  4:25       ` Lloyd Zusman
  2004-10-24  4:51       ` s. keeling
  1 sibling, 0 replies; 7+ messages in thread
From: Lloyd Zusman @ 2004-10-24  4:25 UTC (permalink / raw)
  To: zsh-users

Bart Schaefer <schaefer@brasslantern.com> writes:

> [ ... ]
>
> On Sat, 23 Oct 2004, s. keeling wrote:
>
>> Incoming from Lloyd Zusman:
>> >    alias dfn="rxvt +sb -fn '$RXVTNEWSFONT' -geometry 128x51+69+42 \
>> >       -e nice /usr/bin/slrn -f /home/keeling/.jnewsrc-dfn \
>> >       -h news.individual.net"
>> > [snip]
>> > 
>> > This works because the single quotes are treated as normal (non-quoting)
>> .....................^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> > characters when inside of double quotes; therefore, the RXVTNEWSFONT
>> ..^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> That was a surprise to me.  Thanks.  Your excellent explanation has
>> solved it for me.  Much appreciated.
>
> Lloyd's suggestion works in this case, but it would fail in the event that
> the value of the variable contained any single-quote characters.  A better
> solution would be to swap the single and double quotes:
>
> alias dfn='rxvt +sb -fn "$RXVTNEWSFONT" -geometry 128x51+69+42 ...'

Well, as you probably know, that's another of the suggestions that I
made  (see the bottom part of my original reply in this thread).



-- 
 Lloyd Zusman
 ljz@asfast.com
 God bless you.


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

* Re: Porting an alias from bash to zsh fails.
  2004-10-24  4:09     ` Bart Schaefer
  2004-10-24  4:25       ` Lloyd Zusman
@ 2004-10-24  4:51       ` s. keeling
  2004-10-24 15:59         ` Bart Schaefer
  1 sibling, 1 reply; 7+ messages in thread
From: s. keeling @ 2004-10-24  4:51 UTC (permalink / raw)
  To: zsh-users

Incoming from Bart Schaefer:
> On Sat, 23 Oct 2004, s. keeling wrote:
> 
> > Hi list.  I'm new to zsh so this could well be pretty simple.  I've been 
> > wondering why the following works in bash, but fails miserably in zsh.
> > [NO_MATCH explain snipped]

Ah.  Hmm.

> >    RXVTNEWSFONT='-*-neep alt-medium-*-normal-*-*-100-75-75-c-*-iso8859-1'
> > 
> >    alias dfn="rxvt +sb -fn $RXVTNEWSFONT -geometry 128x51+69+42 \
> >       -e nice /usr/bin/slrn -f /home/keeling/.jnewsrc-dfn \
> >       -h news.individual.net"
> 
> This one would have worked for you if only you'd put the entire thing in
> single quotes instead of double quotes.  There's no reason to expand the

This is better.  Specifically, when I type "alias", I see:

  dfn='rxvt +sb -fn "$RXVTNEWSFONT" -geometry 128x51+69+42 \ 
      -e nice /usr/bin/slrn -f /home/keeling/.jnewsrc-dfn \
      -h news.individual.net'

                                                                [s/\\$//g]

... instead of seeing the _expanded_ version of $RXVTNEWSFONT in
there.

Thanks.  Much appreciated.

  --------------------

Perhaps I should start a new thread here, but should I assign any
significance to the fact that bash =~ 0.51 Mb and zsh =~ 0.4 Mb?
Specifically:

  dpkg -l zsh
  ii  zsh   4.0.4-33   A shell with lots of features.

If it's got "lots of features" (presumably, > bash), why's it smaller?
More efficient coding, or does zsh throw out extraneous stuff that bash
cares about?


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)               http://www.spots.ab.ca/~keeling 
- -


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

* Re: Porting an alias from bash to zsh fails.
  2004-10-24  4:51       ` s. keeling
@ 2004-10-24 15:59         ` Bart Schaefer
  2004-10-24 19:41           ` s. keeling
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2004-10-24 15:59 UTC (permalink / raw)
  To: s. keeling; +Cc: zsh-users

On Sat, 23 Oct 2004, s. keeling wrote:

> Perhaps I should start a new thread here, but should I assign any
> significance to the fact that bash =~ 0.51 Mb and zsh =~ 0.4 Mb?

You mean, the size of the binaries on disk?

Have you looked at "ls -l ${^module_path}/*" ?


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

* Re: Porting an alias from bash to zsh fails.
  2004-10-24 15:59         ` Bart Schaefer
@ 2004-10-24 19:41           ` s. keeling
  0 siblings, 0 replies; 7+ messages in thread
From: s. keeling @ 2004-10-24 19:41 UTC (permalink / raw)
  To: zsh-users

Incoming from Bart Schaefer:
> On Sat, 23 Oct 2004, s. keeling wrote:
> 
> > Perhaps I should start a new thread here, but should I assign any
> > significance to the fact that bash =~ 0.51 Mb and zsh =~ 0.4 Mb?
> 
> You mean, the size of the binaries on disk?
> 
> Have you looked at "ls -l ${^module_path}/*" ?

Thanks.  I was unaware of those.  So much stuff to read when you start
playing with a new toy.  :-)


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)               http://www.spots.ab.ca/~keeling 
- -


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

end of thread, other threads:[~2004-10-24 19:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-23 21:52 Porting an alias from bash to zsh fails s. keeling
     [not found] ` <m3mzyd6pzp.fsf@asfast.com>
2004-10-23 23:14   ` s. keeling
2004-10-24  4:09     ` Bart Schaefer
2004-10-24  4:25       ` Lloyd Zusman
2004-10-24  4:51       ` s. keeling
2004-10-24 15:59         ` Bart Schaefer
2004-10-24 19:41           ` s. keeling

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).