Daily Archives: May 13, 2009

Let’s have a look at cat (Linux, bash)

First, the video, then the discussion:

Sean claims that ‘cat’ is short for ‘concatenate’ … which is what I always thought (I’m sure ‘cat’ is ‘concatinate’ in at least one relatively common computer language other than bash).

If you man cat you do indeed get a statement that says “cat – concatenate files and print on the standard output.”

It has become fashionable over the last few years for shell programmers to eschew cat. It is often the case that using cat is redundant with some other way of doing something which is seen as better for some reason, but that reason is often rather obscure or irrelevant. Like, “you are using six more processing cycles” or whatever … on your 2.3 megahertz dual quad core computer that was otherwise mainly just sitting there handling mouse input.

So, the coolest thing about cat is that you can use it to take over the world. cat is the world’s simplest text editor. Type cat with a redirect to a file, like Sean demonstrated, and then write a C++ program that hacks the World Bank, and you’re there.

cat has a lot of options, such as -n which numbers the output lines, and -b which numbers only the none blank lines.

Personally, I like to use cat as a feeding device for some other part of a script. I use cat to produce output from a file of test data, and then I mess with that output until I get the results I’m looking for, and then I work upstream and replace the cat command with some other code (which is supposed to produce the output that the test data mimicked).

I know, I know. I’m wasting cycles. But I have extra cycles, I promise.

Knowing More Languages = Good

American politicians, some parents, and a few others have previously expressed the concern that learning more than one language muddles the mind. This is, of course, absurd, and it is hard to believe why anyone really thought this. In fact, it could be said that having more than one language under your belt makes it easier to learn yet another language, a demand Americans often place on foreigners or immigrants to the US which is less often placed on the Americans (see this discussion).

Now, to support the idea that having more languages is good for the mind is being demonstrated at the Language Acquisition Lab at Cornell. According to Barbara Lust, “Cognitive advantages follow from becoming bilingual… These cognitive advantages can contribute to a child’s future academic success.”

There is a press report providing some of the lab’s results here.

Pretty new science news: asteroid named, chick born

The ‘Atiras’

The first asteroid ever discovered that has an orbit completely inside the Earth’s, found by an MIT Lincoln Laboratory telescope in 2003 (with multiple exposures marked in red), has been formally named Atira by its discoverers. Seven more such inner-Earth orbit (IEO) asteroids have been found since, and the group is now classed as the Atiras.

Click the link above for a picture.

Successful translocation sees first petrel chick

The first Bermuda Petrel Pterodroma cahow chick to be born on Nonsuch Island, Bermuda, for almost 400 years, has recently hatched, the result of a successful translocation programme.