Unix tip

Monday, October 4th, 2010 17:47
[personal profile] kpreid

The following command is not idempotent:

cat * > cat.txt

(no subject)

Date: 2010-10-04 21:49 (UTC)
From: [identity profile] kpreid.livejournal.com
I didn't notice that something was really wrong until the print-preview finally came up and told me there were 23k pages...

Also: the command would fail the first time if the shell expanded wildcards after performing redirections, instead of the other ordering.

(no subject)

Date: 2010-10-06 15:20 (UTC)
From: [identity profile] virkony.livejournal.com
but "cat * > .cat.txt" is idempotent in most of shells

(no subject)

Date: 2010-10-23 17:15 (UTC)
From: (Anonymous)
ln -s /bin/cat cat.txt