How to say this in Bash?

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon May 25 12:11:05 UTC 2009


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.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090525/29be82f4/signature.pgp


More information about the freebsd-questions mailing list