bug-bash
[Top][All Lists]
Advanced

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

Re: Syntax Question...


From: Linda Walsh
Subject: Re: Syntax Question...
Date: Thu, 18 Aug 2011 23:03:41 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666

Greg Wooledge wrote:
 On Tue, Aug 16, 2011 at 03:41:19PM -0700, Linda Walsh wrote:
> Ken Irving wrote:
>> Maybe this?  today_snaps=( ${snap_prefix} )

>   but as you mention, that will put them into an array....sorry
>   "imprecise terminology".... list for me is some number of objects
>   in a string separated by some separator.

 This is an extremely bad idea. >>[IN GENERAL]<<,
----

But not in the specific case I am using it.  I'm searching for filenames
of a fixed format @GMT-DATE-TIME -- having a space or any other
unexpected character in them cannot happen/is not allowed.  The SW that
works with those files requires that format -- so there is no
possibility of the sky falling.


 [quaint, _known_, argument(s) boiling down to Q: "what sep to use
 between chars", elided]
---

   What would I use?   NUL (\000)....  can't be in most names;
Now if only Bash would support that (I do seem to remember asking
for something like that a few-several months back).  More than on
person expressed shock at such a crazy idea -- yet, it's not hard
to encapsulate 'nul's if you follow current security practices and
always keep a 'strlen' to bound the string rather than looking for a
token (NUL).

   As far as being concerned about spaces in fn's in generally -- you
are preaching to the choir...  I've used spaces and unicode in my
filenames for maybe 10 years or more...so I HAVE to make allowances
for their usage...or the programs I write would be useless for me!

   If fact, I was on the side of the coin that said people should assume
spaces -- as when I first learned shell, that WASN'T the standard (back
in the 80's)...  it was standard NOT to use quotes and I used to get
queried about it all the time...in fact.  JUST yesterday or the day
before, Dennis Williamson, asked me why I put quotes around something I
didn't want to 'expand'   --   because if I didn't it was subject to
alias expansion -- so I'll even quote commands if I really need the
'official command' (or give an absolute path).

I constantly am using odd looking but valid filenames: example of one
from my C:\tmp dir on a win7 machine:

C:\tmp>dir C*W*
Volume in drive C is System Disk

08/18/2011  17:36       0          0 C:\Windows

---
a file on windows that really looks like it has 2 of MS's most
sacred chars used in a filename -- but of course, they are display or
fullwidth forms.


I also use 'spaces, mixed case and even a backslash in names in
/etc/{passwd,group}.    most of the
spaces and mixed case names are in the groups file, the \ is in the
passwd file - it allows the server to 'ID' me when I login as
"Domain\user" -- it's just a dup of my local entry, but w/o it, I'd
have to remember to specify a valid username each time I logged in,
as the username when I login from Win7->my server is 'domain/user'.


My host and domain names are also mixed case -- something that isn't
a big deal, now, w/windows defaulting to case-preserving, but ignoring,
but Samba still upcases domain and host names  -- so that caused
problems.  Already filed a bug, but the problem affects so many
areas, that they want me to break it down in to smaller pieces for
them. (i.e. closed out overall problem description while acceding the
point that it was a real problem -- but that I needed to break it
down by part....)...*sigh*.


I  think I'm probably more conscious of quoting issues in my
code than the average person, due to using all the special cases myself
-- and, of course requiring that the code I write work on MY FILES as
well!  ;-)



So with pre-known filenames that are always in a fixed form, do you
really feel storing such such in a space separated string is a bad
thing?





reply via email to

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