Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 2009 07:36:45 -0700 (PDT)
From:      Unga <unga888@yahoo.com>
To:        Matthew Seaman <m.seaman@infracaninophile.co.uk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How to say this in Bash?
Message-ID:  <141688.69137.qm@web57006.mail.re3.yahoo.com>

index | next in thread | raw e-mail


--- On Mon, 5/25/09, Matthew Seaman <m.seaman@infracaninophile.co.uk> wrote:

> From: Matthew Seaman <m.seaman@infracaninophile.co.uk>
> Subject: Re: How to say this in Bash?
> To: "Unga" <unga888@yahoo.com>
> Cc: freebsd-questions@freebsd.org
> Date: Monday, May 25, 2009, 8:10 PM
> Unga wrote:
> > Dear all
> > 
> > This may be slightly OT, but I'm using on a FreeBSD
> machine. How
> > to convert following into bash style?
> > 
> > echo "${X}" > ${Z}
> > echo "${Y}" >> ${Z}
> > 
> 
> Exactly the same in posix standard /bin/sh or in
> bash.  bash(1) should
> be capable of running any compliant /bin/sh script
> directly.  The converse
> is not generally true, so for maximum portability write
> according to sh(1)
> and avoid bash-isms.
> 
> If you're asking about converting csh to bourne shell, then
> that's a whole
> other kettle of fish.  The echo commands above just
> happen to be the same in
> either language, but that's one of the few points of
> confluence between the
> two.  Typically you'ld have to know both languages and
> laboriously translate
> between them.
> 

Here is what happens in bash shell:
$ echo "${X}" > ${Z}
bash: ${Z}: ambiguous redirect

Best regards
Unga






help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?141688.69137.qm>