miriam_e: from my drawing MoonGirl (Default)
[personal profile] miriam_e
I was writing a quick little script today... well, at least it started out as a quick little script, but it needed to be able to read the directory names from an arbitrary place in my file structure. I thought, sure, the ls command is bound to have an option to restrict output to only directories, right? Wrong. This turned into quite a chase.

After spending too long experimenting with various things I checked the net to see if anybody else knew the answer to what I was starting to think I was too stupid to see. It seems many other people have come up against this deficiency in the ls command. There have been a lot of suggestions to get around it. The most common is:
    ls -d */
but that has three failings. It prints the entire path, lists the directories with a trailing slash (the -d option), and doesn't see hidden dirs (those that begin with a dot). It is easy to use sed to get rid of the trailing slash:
    ls -d1 */ | sed 's/\(.*\)./\1/g'
and a little more fussing with sed can get rid of the path, but I can't find any way to list the hidden dirs along with the normal ones.

Another common solution is to use the find command:
    find . -maxdepth 1 -type d
This works but puts all the output on one line, precedes each file with its path, the first line is always the name of the directory being listed, and the file list is all jumbled up. I can use the -printf option of file to fix the path problem and to put each name on its own line, getting rid of the first line is just a matter of piping through the tail command, and pipe through the sort command to organise the result.
    find . -maxdepth 1 -type d -printf '%f\n' | tail -n+2 | sort

That took a lot more hassling than I expected. Weird. You'd think that the ls command would have something that basic. The Amiga does:
    dir . dirs
Simple, easy to use and understand.

GNU dir command has a -d option supposedly to display only directories, but it doesn't seem to work properly.

Additional:
I don't seem to be able to leave it alone. Here is a weird solution that I never would have thought of: use the bash shell's wildcard expansion to do it.
    echo */
This has a couple of shortcomings, but as always, sed can help:
    cd "$address" ; echo */ | sed 's/\/ */\n/g'
We cd to the directory that we want to list from. The echo gets expanded to everything there that ends in a slash (all the directories), then sed looks for a slash followed by none or multiple spaces (can't just be a space because the very last slash doesn't have a space) and replaces them with a newline.

I'm astounded that linux doesn't have an easy solution to this. Even crappy old MSDOS can do it.
    DIR /A:D /B /O:N
Not very readable, but at least it does it.

Additional:
I have a commandline program called tree though I can't remember where I got it. I don't think it is standard on linux distros, but it has a lot of nice options, including the ability to print out a list of directories. It has one tiny failing, in that it begins the list with the name of the containing directory, but as before we can simply snip that off with tail:
    tree -ad -L 1 -i "$address" | tail -n+2

Nice.

Found where I got it. http://mama.indstate.edu/users/ice/tree/

It was written by Steve Baker (ice@mama.indstate.edu) with HTML output capability Francesc Rocher (rocher@econ.udg.es) and character sets by Kyosuke Tokoro (NBG01720@nifty.ne.jp)

Date: 2012-05-25 02:48 pm (UTC)
twwells: Me, circa 2000. (Default)
From: [personal profile] twwells
I have dillo, firefox, and lynx, and use them in that order of frequency. Which goes to prove that utility does not equal quality, because that is the inverse order of their quality! Dillo is really buggy but it has the combination of features I need. Firefox has plenty of bugs (and uses far too much memory) but it does javascript and it's the one that too many my-HTML chauvinists code for. Lynx has no bugs that have caused me problems, but only renders text. So, I just pick the right tool for the job, which usually turns out to be dillo.

I disagree with the notion that values are intrinsic. Values are always relative; to say that something has a value one must implicitly or explicitly have a particular thing that values it This doesn't invalidate your value monoculture essay. If anything, it strengthens it. If a value is always relative to that which has the value, it is impossible to make your values and mine commensurable. Yet, on the money-is-the-only-value theory, money is a common denominator for all values. Thus the money monoculture can't work, because it is based on a logical contradiction.

A Turing machine is a very simple kind of computer. Turing invented it because it is mathematically tractable. What he proved is that a Turing machine can simulate any digital computer. And, since it is trivial to make a real computer simulate a (finite) Turing machine, one can simulate on one computer a Turing machine that simulates another computer. Thus, any computer can simulate any other computer. The obverse of a Turing machine's mathematical tractability is that it is horribly inefficient; you would not want to try to simulate an adding machine on one (except for fun), much less a brain. However, if a brain can be simulated at all, you could simulate it on a Turing machine.

I note that, even if the brain is digital, it can still be chaotic (and almost certainly would be). If so, it might turn out that it's possible to create an artificial mind but not to upload to one, because of unavoidable measurement errors.

Here's an answer to your "expanding balloon" objection. Think of objects as raisins embedded in the balloon. Only the rubber expands; the raisins don't. I should point out that all of these analogies are essentially worthless if one wants to really understand what's going on in cosmology; they capture the flavor of the science but almost nothing of its substance.

If you have a taste for math, it would profit you to look into Riemannian geometry, since that's the math that General Relativity is based on. If math isn't your thing, I can attempt to provide analogies that answer your other objections.

I make a distinction beyond the hypothesis/theory dichotomy you mentioned. A theory is, in essence, a relationship between facts. A model is a method of prediction. Ideally, a theory is also predictive but it doesn't have to be. Conversely, a model is ideally based on a relationship between facts but it doesn't have to be. One of my objections to modern science is that it conflates the two, and insists that a science that isn't predictive isn't science. I can sympathize with the reasons for that insistance but I can't agree with it.

Quantum Mechanics proper is a model because it is agnostic about the underlying reality. Only if one adds to QM some interpretation, such as Copenhagen or Many Worlds, does one have a theory. Why is this important? A theory, if true, tells us something about reality. Models don't. However useful a model is (and QM is very useful), it can't tell us anything about how reality actually works. So all of those claims that reality is "really" random because QM uses randomness in its predictions are simply wrong. Such a claim would only be arguable if QM were a theory, but it isn't.

What did you find creepy about "True Names"? I did read "Permutation City" but I didn't like it. There were two reasons. First, I didn't find the ideas particularly new. Second, my main interest in stories is to read about characters I enjoy spending time with and I didn't get that from the book.

When talking about "god", it's very important to distinguish two very different concepts. Most religions are based on the supernatural, a realm that differs from the natural by having no fixed nature. Scientology and the "aliens as creators" hypothesis are altogether different, in that they don't suppose anything supernatural. The arguments against the two are different, not just in details, but in kind. In the former, the arguments stem from the logical incoherency of the notion of the supernatural; in the latter, the arguments are fact-based, and amount to some variation on "there is no evidence whatsoever for that hypothesis, so it need not be considered".

I'll look at those video players; if they run on Linux they can almost certainly be run on FreeBSD.

Date: 2012-05-26 02:06 pm (UTC)
twwells: Me, circa 2000. (Default)
From: [personal profile] twwells
I think the distinction you're trying to make is between values that are means to an end and those that are not. Most values are means to an end. I don't buy food "just because"; I buy it so that I can eat it. Food is a value to me because it enables me to eat. Happiness, as you see it, is different from food, because you don't seek out happiness for any particular purpose; you experience happiness directly as valuable and so do not need any other end to justify seeking it out. Is that correct? (I should note that I don't see happiness as an end in itself. But that's whole 'nother discussion. :))

Though there are serious problems with the standard cosmologies, the problems you have with them are not among those serious problems. But to explain why your objections are invalid, I will have to use some math. Analogies won't do; they can only convey flavor without substance.

Science is full of good models, QM and Boyle's law among them. Science has since successfully explained why Boyle's law works but has yet to explain QM. It sure would be nice to see that explanation....

It's rather frustrating to know that I'm right at the cusp—were I even a decade younger it's a virtual certainty that I would be able to surf the wave of ever improving life extension techniques and thereby not have to expire of old age. Ah well, reality is.

I think you've got "True Names" mixed up with another story. It's worth a read, not just for the story, but for its historical value.

I don't know enough about scientology to know whether its "aliens" are merely supernatural spirits in disguise. And, frankly, I'd rather spend my time cleaning a cesspool than look into the matter. I merely give them the benefit of the doubt (as silly as that may be) by assuming that they're not supernatural.

It turns out that the video programs you mentioned are all ported to FreeBSD. I was able to download them from a standard location. However, I'm an untrusting soul and so I've got to figure out a way to run those programs without giving them a chance to infect my system.

Date: 2012-05-27 03:13 am (UTC)
twwells: Me, circa 2000. (Default)
From: [personal profile] twwells
It might not be a good idea to call values that are ends in themselves "intrinsic", as that word generally has a different meaning. Head over to The Free Dictionary to see what I mean.

As for whether happiness is a final value or a means to survival, that depends on how one chooses. Some will decide to make happiness their final goal; others will decide to seek it as a means to an end. I'm in a third camp: One should not pursue happiness as such. Rather, one should pursue certain other values and one's happiness will be one signal of one's success at that pursuit.

The main hope for those of us on the cusp is that the growth of knowledge is at least exponential. Then again, what with government meddling in the biological sciences, there's a damned good chance that important research will be stifled by religiously inspired "ethics". i have little hope that people will abandon that idiocy.

Ah, Ben Bova. He's OK but he writes too mainstream-like for me.



Profile

miriam_e: from my drawing MoonGirl (Default)
miriam_e

December 2025

S M T W T F S
 123456
7 8 910 111213
1415 1617181920
21222324252627
28293031   

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 26th, 2025 07:37 am
Powered by Dreamwidth Studios