[NCLUG] bash question

Marcio Luis Teixeira marciot at yahoo.com
Fri Apr 27 17:14:50 MDT 2007


This works:

   echo -ne "\n" | od -t x1 -t a

I think the problem with your example is the outer echo discards the 0x0a -- perhaps it strips off control charaters?

Notice, that your counter-example, when written using nested echos, also does not work:

echo -n "$(echo -n '
')" | od -t x1 -t a

0000000

So it's the outer echo that's getting rid of the 0x0a.

-- Marcio


----- Original Message ----
From: Warren Turkal <wt at penguintechs.org>
To: nclug at nclug.org
Sent: Friday, April 27, 2007 4:23:26 PM
Subject: [NCLUG] bash question

Everyone,

Can anyone explain why the following doesn't result in a newline (0x0a)
being piped to od?

wt at pyrus:~/test/ctest$ echo -n "$(echo -ne "\n")" | od -t x1 -t a
0000000


The following works as expected:

wt at pyrus:~/test/ctest$ echo -n "
" | od -t x1 -t a
0000000 0a
         nl
0000001


Is this a bug in bash or am I just doing something silly?

wt
-- 
Warren Turkal
Penguin Techs...Taking the "hertz" out of gigahertz!(TM)
901-338-1337
_______________________________________________
NCLUG mailing list       NCLUG at nclug.org

To unsubscribe, subscribe, or modify 
your settings, go to: 
http://www.nclug.org/mailman/listinfo/nclug




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the NCLUG mailing list