zsh-users
 help / color / mirror / code / Atom feed
* Problems running  echo -e in a variable
@ 2001-02-14 20:00 Heinrich Götzger
  2001-02-14 20:45 ` Bart Schaefer
  2001-02-14 21:59 ` Thomas Köhler
  0 siblings, 2 replies; 4+ messages in thread
From: Heinrich Götzger @ 2001-02-14 20:00 UTC (permalink / raw)
  To: zsh-users

Hi there,

I' ve got 2 questions using zsh as shell-script interpreter. To track it
more easily, I'm splitting it in 2 different mails.

Running zsh version 3.1.6 included in SuSE Linux 7.0 I got some trouble
using "echo -e" in a variable:

$ echo -e "Hallo Heinrich"
Hallo Heinrich

is ok, but:

$ ECHO="echo -e"
$ $ECHO "Hallo Heinrich"
zsh: command not found: echo -e

also with {} it brings the same:
$ ${ECHO} Hallo Heinrich
zsh: command not found: echo -e

How can I avoid this?

I've seen it working with ksh or bash.

Regards and thanks for the help

Heinrich Götzger



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

* Re: Problems running  echo -e in a variable
  2001-02-14 20:00 Problems running echo -e in a variable Heinrich Götzger
@ 2001-02-14 20:45 ` Bart Schaefer
  2001-02-14 21:26   ` Heinrich Götzger
  2001-02-14 21:59 ` Thomas Köhler
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2001-02-14 20:45 UTC (permalink / raw)
  To: zsh-users, Heinrich Go%tzger

On Feb 14,  9:00pm, Heinrich Go%tzger wrote:
> Subject: Problems running  echo -e in a variable
> Hi there,
> 
> I' ve got 2 questions using zsh as shell-script interpreter.

If you're using zsh as an interpreter for Bourne shell scripts, then you
should be telling it to "emulate sh", which you can do either by using
the emulate command or by linking zsh to the name "sh" and then running
it by that name.

There's a lot more about this in the FAQ, which is probably in /usr/doc/zsh*
somewhere (I don't recall how SuSE organizes its zsh RPM).

> $ ECHO="echo -e"
> $ $ECHO "Hallo Heinrich"
> zsh: command not found: echo -e

This needs "setopt SH_WORD_SPLIT" which happens for you when emulating sh.


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

* Re: Problems running  echo -e in a variable
  2001-02-14 20:45 ` Bart Schaefer
@ 2001-02-14 21:26   ` Heinrich Götzger
  0 siblings, 0 replies; 4+ messages in thread
From: Heinrich Götzger @ 2001-02-14 21:26 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

Thanks for the quick answer.
it works very fine!

On Wed, 14 Feb 2001, Bart Schaefer wrote:

>If you're using zsh as an interpreter for Bourne shell scripts, then you
>should be telling it to "emulate sh", which you can do either by using
>the emulate command or by linking zsh to the name "sh" and then running
>it by that name.

>There's a lot more about this in the FAQ, which is probably in /usr/doc/zsh*
>somewhere (I don't recall how SuSE organizes its zsh RPM).
just to complete here:
SuSE have it in /usr/share/doc/packages/zsh
and it is very informative.

>> $ ECHO="echo -e"
>> $ $ECHO "Hallo Heinrich"
>> zsh: command not found: echo -e
>
>This needs "setopt SH_WORD_SPLIT" which happens for you when emulating sh.

Regards

Heinrich


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

* Re: Problems running  echo -e in a variable
  2001-02-14 20:00 Problems running echo -e in a variable Heinrich Götzger
  2001-02-14 20:45 ` Bart Schaefer
@ 2001-02-14 21:59 ` Thomas Köhler
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Köhler @ 2001-02-14 21:59 UTC (permalink / raw)
  To: zsh-users

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

On Wed, Feb 14, 2001 at 09:00:39PM +0100,
Heinrich Götzger <goetzger@gmx.net> wrote:
> 
> Hi there,
> 
> I' ve got 2 questions using zsh as shell-script interpreter. To track it
> more easily, I'm splitting it in 2 different mails.
> 
> Running zsh version 3.1.6 included in SuSE Linux 7.0 I got some trouble
> using "echo -e" in a variable:
> 
> $ echo -e "Hallo Heinrich"
> Hallo Heinrich
> 
> is ok, but:

Of course it is :-)

> $ ECHO="echo -e"
> $ $ECHO "Hallo Heinrich"
> zsh: command not found: echo -e

So, zsh doesn't split $ECHO.

> also with {} it brings the same:
> $ ${ECHO} Hallo Heinrich
> zsh: command not found: echo -e

Of course, ${ECHO} is basically the same as $ECHO :-)

> How can I avoid this?
> 
> I've seen it working with ksh or bash.

setopt sh_word_split
:-)

> Regards and thanks for the help
> 
> Heinrich Götzger

Ciao,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

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

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

end of thread, other threads:[~2001-02-14 23:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-14 20:00 Problems running echo -e in a variable Heinrich Götzger
2001-02-14 20:45 ` Bart Schaefer
2001-02-14 21:26   ` Heinrich Götzger
2001-02-14 21:59 ` Thomas Köhler

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