|
List Info
Thread: echo bug?
|
|
| echo bug? |
  United States |
2007-12-07 17:33:22 |
I'm not sure if the problem is echo or the bash shell.
echo -e "123n 456"
yields the proper spacing. However,
text="123n 456"
echo $text
does not. Why not?
--
% Randy Yates % "My Shangri-la has
gone away, fading like
%% Fuquay-Varina, NC % the Beatles on 'Hey
Jude'"
%%% 919-577-9882 %
%%%% <yates ieee.org> % 'Shangri-La', *A
New World Record*, ELO
http://www.digitalsi
gnallabs.com
|
|
| Re: echo bug? |
  United States |
2007-12-09 04:13:59 |
On Fri, 07 Dec 2007 18:33:22 -0500, Randy Yates wrote:
> I'm not sure if the problem is echo or the bash shell.
>
> echo -e "123n 456"
>
> yields the proper spacing. However,
>
> text="123n 456"
> echo $text
>
> does not. Why not?
try echo -e $text
|
|
| Re: echo bug? |
  United States |
2007-12-09 18:15:35 |
jellybean stonerfish <stonerfish geocities.com> writes:
> On Fri, 07 Dec 2007 18:33:22 -0500, Randy Yates wrote:
>
>> I'm not sure if the problem is echo or the bash
shell.
>>
>> echo -e "123n 456"
>>
>> yields the proper spacing. However,
>>
>> text="123n 456"
>> echo $text
>>
>> does not. Why not?
>
> try echo -e $text
Sorry - that's what I meant to type. That is to say,
"echo -e $text$"
doesn't work.
--
% Randy Yates % "I met someone who
looks alot like you,
%% Fuquay-Varina, NC % she does the
things you do,
%%% 919-577-9882 % but
she is an IBM."
%%%% <yates ieee.org> % 'Yours
Truly, 2095', *Time*, ELO
http://www.digitalsi
gnallabs.com
|
|
| Re: echo bug? |

|
2007-12-09 18:45:51 |
Randy Yates <yates ieee.org> wrote:
> Sorry - that's what I meant to type. That is to say,
"echo -e $text$"
> doesn't work.
Without knowing what "doesn't work" is supposed to
mean, and guessing
that last "$" was a typo, I think what you're
missing is that variable
expansions that aren't quoted are subject to word splitting
at
whitespace. If you want to preserve the whitespace in a
variable's
value, you have to quote it when expanding it:
echo -e "$text"
paul
|
|
| Re: echo bug? |
  United States |
2007-12-09 21:19:36 |
prj po.cwru.edu (Paul Jarc) writes:
> Randy Yates <yates ieee.org> wrote:
>> Sorry - that's what I meant to type. That is to
say, "echo -e $text$"
>> doesn't work.
>
> Without knowing what "doesn't work" is
supposed to mean,
Oh, I think it's pretty clear to anyone with a reasonable
intellect.
> and guessing
> that last "$" was a typo,
Good guess!
> I think what you're missing is that variable
> expansions that aren't quoted are subject to word
splitting at
> whitespace.
Is it the shell itself that performs this word splitting or
the echo command?
> If you want to preserve the whitespace in a variable's
> value, you have to quote it when expanding it:
> echo -e "$text"
I thank you for that valuable piece of information!
--
% Randy Yates % "Ticket to the moon,
flight leaves here today
%% Fuquay-Varina, NC % from Satellite 2"
%%% 919-577-9882 % 'Ticket To The Moon'
%%%% <yates ieee.org> % *Time*, Electric
Light Orchestra
http://www.digitalsi
gnallabs.com
|
|
| Re: echo bug? |

|
2007-12-09 22:22:45 |
Randy Yates <yates ieee.org> wrote:
> prj po.cwru.edu (Paul Jarc) writes:
>> Without knowing what "doesn't work" is
supposed to mean,
>
> Oh, I think it's pretty clear to anyone with a
reasonable intellect.
That's not a good way to encourage people to help you. A
good way to
get help is to show people what they would see if they were
looking
over shoulder: copy and paste exactly what you did and
exactly what the
results were, and then show what you expected to get
instead. You may
find it tedious, but it's very effective for getting
answers.
>> I think what you're missing is that variable
>> expansions that aren't quoted are subject to word
splitting at
>> whitespace.
>
> Is it the shell itself that performs this word
splitting or
> the echo command?
Anyone with a reasonable intellect would have read the
documentation
before posting, and wouldn't have to ask that question.
paul
|
|
| Re: echo bug? |
  United States |
2007-12-09 22:46:52 |
prj po.cwru.edu (Paul Jarc) writes:
> Randy Yates <yates ieee.org> wrote:
>> prj po.cwru.edu (Paul Jarc) writes:
>>> Without knowing what "doesn't work"
is supposed to mean,
>>
>> Oh, I think it's pretty clear to anyone with a
reasonable intellect.
>
> That's not a good way to encourage people to help you.
Asking for help does not give permission to denigrate.
> A good way to
> get help is to show people what they would see if they
were looking
> over shoulder: copy and paste exactly what you did and
exactly what the
> results were, and then show what you expected to get
instead. You may
> find it tedious, but it's very effective for getting
answers.
It is more likely to get a proper answer, but I took my
chances as I
thought the likelihood of being correctly understood was
quite high
(with people of reaosnable intellect).
> Anyone with a reasonable intellect would have read the
documentation
> before posting, and wouldn't have to ask that
question.
Again another error in your judgement. Without knowing where
to look,
the search space is enormous.
Oh, and stop sending me direct emails.
--
% Randy Yates % "And all that I can
do
%% Fuquay-Varina, NC % is say I'm sorry,
%%% 919-577-9882 % that's the way it
goes..."
%%%% <yates ieee.org> % Getting To The
Point', *Balance of Power*, ELO
http://www.digitalsi
gnallabs.com
|
|
| Re: echo bug? |

|
2007-12-09 23:55:22 |
Randy Yates <yates ieee.org> wrote:
> Asking for help does not give permission to denigrate.
What exactly did you find to be denigrating?
> Without knowing where to look, the search space is
enormous.
Try "man echo" and "man bash".
paul
|
|
| Re: echo bug? |
  United States |
2007-12-10 14:24:20 |
prj po.cwru.edu (Paul Jarc) writes:
> Randy Yates <yates ieee.org> wrote:
>> Asking for help does not give permission to
denigrate.
>
> What exactly did you find to be denigrating?
"Without knowing what 'doesn't work' is supposed to
mean..."
sounds denigrating to mean.
If you had only read the post to which you were responding,
I agree the
meaning would be unclear. But taken with my original post,
it seemed
pretty clear to me that I was simply saying that the spacing
with the
"-e" option is not correct, which is what I
originally meant to write.
OK ok - I accede your point - if I had simply cut and pasted
it, I
could have avoided this error.
>> Without knowing where to look, the search space is
enormous.
>
> Try "man echo" and "man bash".
I did that before I posted, but I guess I missed it. The
keyword is
"EXPANSION" and I didn't know to look under that
keyword, and reading
through the entire bash man page is quite tedious.
I've never cared for the bash man page - it's too big and
covers too
many topics in one page. Organizing things a little more
hierarchically
would greatly aid digestion.
--
% Randy Yates % "She tells me that
she likes me very much,
%% Fuquay-Varina, NC % but when I try to
touch, she makes it
%%% 919-577-9882 %
all too clear."
%%%% <yates ieee.org> % 'Yours
Truly, 2095', *Time*, ELO
http://www.digitalsi
gnallabs.com
|
|
| Re: echo bug? |
  United States |
2007-12-10 14:27:58 |
Randy Yates <yates ieee.org> writes:
> [...]
> I've never cared for the bash man page - it's too big
and covers too
> many topics in one page. Organizing things a little
more hierarchically
> would greatly aid digestion.
Actually I just checked and the info page on bash *IS*
organized more
hierarchically. Doh!
I admit I have a bad aversion to using info - man seems so
much easier.
--
% Randy Yates % "Watching all the
days go by...
%% Fuquay-Varina, NC % Who are you and who am
I?"
%%% 919-577-9882 % 'Mission (A World
Record)',
%%%% <yates ieee.org> % *A New World
Record*, ELO
http://www.digitalsi
gnallabs.com
|
|
[1-10]
|
|