The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - Newcomers (http://hintsforums.macworld.com/forumdisplay.php?f=15)
-   -   removing selected files (http://hintsforums.macworld.com/showthread.php?t=105043)

Hal Itosis 09-08-2009 06:24 PM

Hmm, you know what? At this point, an extra 9 chars which make a script work for both case-sensitive and case-insensitive filesystems? Fine, it's worth it. Let's not discuss it any further.

:) [kidding]

Quote:

Originally Posted by EatsWithFingers (Post 551490)
My machine (a G4 PowerBook, circa March 2004) was originally a Panther system and was upgraded to Leopard via an "Archive & Install". I've never reformatted my HD at all, so it's not something I have done willingly (I don't recall being given that option when upgrading to Leopard).

Yeah, it's not an option. We have to plan and prepare for it ourselves (backup everything and -- when booted from the system DVD -- use the Disk Utility there to erase the HD, just before installing the new OS). Only those folks who want to go through all that procedure even bother. I like to do it for major system upgrades, e.g., Tiger to Leopard. I figure the Disk Utility in 10.5.0 knows what's best for OS 10.5.0 -- better than Disk Utility in Tiger or (egads) Panther anyway. A clean install on a virgin disk. Ahh, no worries.

--

Do you use Adobe Products? (Creative Suite, etc.)
I've read they bug-out on case sensitive filesystems.
Then again, it's not 100% clear that's what you have.
[Maybe start a new thread for this... i'm not sure.]

EatsWithFingers 09-08-2009 06:33 PM

Quote:

Originally Posted by Hal Itosis (Post 551500)
Do you use Adobe Products? (Creative Suite, etc.)
I've read they bug-out on case sensitive filesystems.
Then again, it's not 100% clear that's what you have.
[Maybe start a new thread for this... i'm not sure.]

Nope, no Adobe software.

Did you see my (many) edits in the last post? I definitely don't have a case-sensitive system, but passing the 'nocaseglob' option to bash gets me the behaviour you have (i.e. bash is case-sensitive by default). Looks like 'nocaseglob' could be key...

Hal Itosis 09-08-2009 06:41 PM

Quote:

Originally Posted by EatsWithFingers (Post 551490)
EDIT: Upon further reading, the bash shell seems to be case-sensitive, but can be told to be case-insensitive.
Hal, you don't happen to have the 'nocaseglob' option set, do you? (e.g. in your .bashrc or .bashprofile files)

If I set that option, I get the output you get:

Code:

Test $> shopt -s nocaseglob
Test $> ls *.tex
1.tex                        3.TEx                5 and a half.teX
2.tex                        4.b.teX                6.TEX
Test $>


Guilty...
Code:

$ shopt |grep glob
dotglob                off
extglob                off
failglob              off
nocaseglob            on
nullglob              off

$ grep glob ~/.b*
/Users/halito/.bashrc:shopt -s nocaseglob

$ shopt -u nocaseglob

$ for i in *.tex; do [ -f "${i%.[Tt][Ee][Xx]}".pdf ] && ls "${i%.*}".[Pp][Dd][Ff]; done
1.pdf


<sigh>
i hate unix. :D

--

You're right, this one's more universal:

for i in *.[Tt][Ee][Xx]; do [ -f "${i%.*}".pdf ] && ls "${i%.*}".[Pp][Dd][Ff]; done

[now i have to find that thread at ars technica where i got mislead last spring... it's probably locked. ;-) ]

EatsWithFingers 09-08-2009 06:55 PM

Quote:

Originally Posted by Hal Itosis (Post 551503)
Guilty...

Hey, at least the tangent which we took this thread on has come to a (satisfying?) end. You had me worried about my system for a while there...! :p

Quote:

Originally Posted by Hal Itosis (Post 551503)
<sigh> i hate unix. :D

It's like the universe: probably makes a lot of sense if you know all the rules governing it! (Unfortunately, no one does...)

ganbustein 09-08-2009 10:27 PM

Quote:

Originally Posted by Hal Itosis (Post 551503)
Guilty...
Code:

$ grep glob ~/.b*
/Users/halito/.bashrc:shopt -s nocaseglob


If you're going to do that, you might as well also do:

Code:

bind 'set completion-ignore-case'
(and why do I think you probably already have?).

The trick is to remember that you've done it.
Unix ought to have a "list all my customizations" command. Hmm... that shouldn't be too hard. Write a script to capture all settable options to a file:

alias -p
bind -pvs
enable -p
shopt -p
set

Generate the same file from a virgin install, and keep it around. (Such a file could be part of a virgin install. Or log in as Guest and run the script.)
Use diff to find all the ways you're different.
You'd probably also want to have a list of ignorable differences (like the value of $USER or $HOME).

No... I will resist. (Another reason to hate unix -- it sucks you in by making everything seem so doable.)

Hal Itosis 09-08-2009 11:12 PM

Quote:

Originally Posted by ganbustein (Post 551548)
If you're going to do that, you might as well also do:
Code:

bind 'set completion-ignore-case'
(and why do I think you probably already have?).

Yes, but for some reason i have...
bind 'set completion-ignore-case on'

Not sure if that trailing "on" is redundant or what. [?]
Can't remember where i dug that up. [i'd like to find a good tutorial on bind.]


Quote:

Originally Posted by ganbustein (Post 551548)
The trick is to remember that you've done it.

Now he tells me. :o

ganbustein 09-09-2009 12:19 AM

Quote:

Originally Posted by Hal Itosis (Post 551557)
Yes, but for some reason i have...
bind 'set completion-ignore-case on'

Not sure if that trailing "on" is redundant or what. [?]

From info readline (which oddly is more complete under Tiger than Leopard, probably because manually installing ruby gave me a later version),

Quote:

Except where noted, readline variables can take the values On or Off
(without regard to case). Unrecognized variable names are ignored.
When a variable value is read, empty or null values, "on" (case-insen-
sitive), and "1" are equivalent to On. All other values are equivalent
to Off.
I'm glad you're back from vacation. Things have been dull without you.


All times are GMT -5. The time now is 10:17 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.