Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!munnari.oz.au!cs.mu.oz.au!kre From: kre@cs.mu.oz.au (Robert Elz) Newsgroups: comp.unix.wizards Subject: Re: Possible bug in SunOS System V echo? Summary: (un)portable echo ... Message-ID: <3851@munnari.oz.au> Date: 2 May 90 16:36:07 GMT References: <4852@helios.TAMU.EDU> <14020094@hpisod2.HP.COM> Sender: news@cs.mu.oz.au Lines: 24 In article <14020094@hpisod2.HP.COM>, decot@hpisod2.HP.COM (Dave Decot) writes: > Of course, the uses of echo that were always portable remain so: > echo Hello world! > echo "This is a variable value: $myvar" > echo "" The 1st and 3rd I agree with, the second one is not portable in general, it depends on the possible range of values for "$myvar". If you know that "myvar" is "yes" or "no", or "1", "2", ... then its fine, but if myvar is random user input, a filename (for myvar in *.c do ...) or anything else that isn't under total control of the script, then you can't rely on the second form. As best as I can tell, there's no easy way to reliably print the value of an unknown variable using the Sys V echo. Try myvar='\n' before the 2nd of the above with the V7 (BSD) and Sys V echos. kre