[NCLUG] bash question

Sean Reifschneider jafo at tummy.com
Sun Apr 29 15:40:41 MDT 2007


On Fri, Apr 27, 2007 at 07:00:07PM -0600, Warren Turkal wrote:
>Is is the outer echo, or is it bash getting rid of it? Is it proper
>behavior?

"-n" removes the trailing newline, which is obviously what is happening
when you play with it a bit:

   guin:~$ echo "$(echo -ne "\n")" | od -c 
   0000000  \n
   0000001
   guin:~$ echo -n "$(echo -ne "\n")" | od -c
   0000000
   guin:~$ 

This may well be a bug in echo, because the documentation says that it just
doesn't add a trailing newline, but clearly what is happening is that the
trailing newline is being stripped, whether echo added it or not.

Sean
-- 
 Get your data structures correct first, and the rest of the program will
 write itself.  -- David Jones
Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995: Ask me about High Availability




More information about the NCLUG mailing list