[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

general bash oddities and discussion (was Re: Syntax Question...)

From: Linda Walsh
Subject: general bash oddities and discussion (was Re: Syntax Question...)
Date: Thu, 18 Aug 2011 10:32:50 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/20100228 Thunderbird/ Mnenhy/

` Greg Wooledge wrote:

   Now that one is suprising, as it's supposed to take the output of
the ... hmmm.....yup!...  that's exactly what it does.
takes the work and executes it and returns the results on stdin as
a single quoted blob of output:

   >  read a <<< *.txt
   >  echo $a
   apc_contact.txt .chklog.txt driver_filename.txt FFcookies.txt
   qb2.txt rcs_kywds-exmpls.txt return_rma.txt Soundtrack-II.txt
   Soundtrack-I.txt winsize.txt

No, you've tripped yourself by failing to quote $a in the echo command.
"a" contains *.txt and your unquoted $a is being expanded (parameter
expansion and then pathname expansion) with the resulting filenames
being passed to echo.

But this is weird:

   { read a b c  } <<<*.txt  <<<*.dat  <<<*.log
   echo $a,  $b,  $c
   .bzr.log h.log q.log texput.log

You're not even using valid syntax.  { read a b c; } is what you have
to use, for a one-liner command group.  And the commas in your echo
command are mysteriously absent in your output.
   You're right...

I went back looking through my screen history...the above was
not cut/pasted from the right places: --- you can see what you are talking about where I did this, -- (i.e the *.txt is expanded at echo time)... BUT the manpage SAYS
it does pn expansion!....(at least it says that in 4.1, dunnow about 4.2).

But the actually lines...

   >  { read a b c; } <<<*.txt <<<*.dat <<<*.log
   >  echo $a
   .bzr.log h.log q.log texput.log
   >  echo $a, $b, $c
   *.log, ,

-- so you're right about the quote expansion -- ...it was in front of my
face and I looked at the wrong line!  *duh!*

Hey, I *know* I'm not perfect...that's
why I try to use so many redundant checks...because everything that can
go wrong, eventually will. I try to write my code to protect itself from me, or protect itself from other code I write....because I know I will forget spellings or some call convention or something, and the program needs to tell me how to fixit, as it may have been so long-ago-written, that I might not remember 'off hand', so I usually try to give some indication of what died and where to look to fix it...

hey, I'm having to answer emails from multiple people and do catchup
(my email was 'waylaid' for about 24 hours (on my server), as my server
no longer knew who I was due to samba problems and it not resolving my
UID/name correctly for a while...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]