4,899 reputation
11625
bio website keith-s-thompson.github.com
location San Diego, CA
age 55
visits member for 3 years, 1 month
seen yesterday

I'm a programmer and all-around nerd living in San Diego, California.
I work at JetHead Development Inc.

E-mail: Keith.S.Thompson@gmail.com


Dec
18
comment Grep lines but let the first line through
I just tried that; it printed the header line first.
Dec
17
comment Convert a .docx to a .pdf with pandoc
@derobert: Running iconv directly on a .docx file is unlikely to work. iconv assumes that its input is a text file in some specified or inferred format. A .docx file is actually a zip file (a compressed archive) containing (mostly) xml files. You might conceivably have some luck unzipping the .docx file, running iconv on the constituent files, and then re-zipping everything back into a new .docx, but I wouldn't bet on it working. For one thing, the xml file containing the actual content of the document specifies its encoding: encoding="UTF-8", for example.
Dec
14
comment Why is it better to use “#!/usr/bin/env NAME” instead of “#!/path/to/NAME” as my shebang?
If it doesn't work with /usr/bin/perl, I'll find out very quickly, and it's the system owner/administrator's responsibility to keep it up to date. If you want to run my script with your own perl, feel free to grab and modify a copy or invoke it via perl foo. (And you might consider the possibility that the 55 people who upvoted this answer also know a thing or two. It's certainly possible that you're right and they're all wrong, but that's not the way I'd bet.)
Dec
14
comment Why is it better to use “#!/usr/bin/env NAME” instead of “#!/path/to/NAME” as my shebang?
@GoodPerson: Suppose I write a Perl script to be installed in /usr/local/bin. I happen to know that it works correctly with /usr/bin/perl. I have no idea whether it works with whatever perl executable some random user happens to have in his or her $PATH. Maybe somebody is experimenting with some ancient version of Perl; because I specified #!/usr/bin/perl, my script (which the user doesn't necessarily even know or care is a Perl script) won't stop working.
Dec
6
comment Pronunciation for /usr directory
Some years ago, at a previous job, I worked on Unix systems with the usual /usr et al setup, and with users' home directories under /user. In that context, pronouncing /usr as "slash user" would not have been a good idea. But I've never seen /user used that way before or since, so it was probably an unusual case.
Dec
4
comment Is it possible to redefine the tilde ('~', home directory)?
Use vipw (or whatever GUI your OS provides) rather than editing /etc/passwd directly. Direct editing risks corrupting the file, which can be difficult to recover from.
Dec
2
comment Cronjob for rebooting everyday
@Michael Kjörling: >& and &> both work in bash; only >& works in csh and tcsh. Since the question uses &>, and csh and tcsh aren't relevent, I've deleted the reference to them.
Dec
2
revised Cronjob for rebooting everyday
`&>` doesn't work in csh and tcsh; remove reference to them.
Nov
23
revised How to conditionally do something if a command succeeded or failed
added 404 characters in body
Nov
21
comment How to pipe the result of a grep search into a new vi file
In fact there's no such thing as a "vi file". vi operates on arbitrary text files; the files themselves are not directly associated with vi. (Or, as I just learned, vi - will cause vi to operate on the contents of stdin; vim does this, but not all versions of vi do.)
Nov
15
comment What are the dangers of creating a normal user with UID < 500?
Debian-derived systems seem to start normal UIDs at 1000, not 500.
Nov
8
comment What do square brackets mean without the “if” on the left?
[ is both a Bash shell builtin and an external command. [[ is only a builtin; in fact type [[ says it's a "shell keyword", unlike [ which is a "shell builtin". (I'm not sure what the real distinction is, though; it seems to be usable as if it were a command.)
Nov
7
comment How to print whole array in tcsh
Hmm. I assumed that set array was an abbreviation of the actual command he used. If he got "word too long", he's obviously setting it to something. Your recent comment on the question is a good one.
Nov
7
comment How to print whole array in tcsh
Ok, but echo "$array" should work perfectly well to print an entire array -- except for the "Word too long" problem, to which printf '%s\n' "$array[-]" is equally vulnerable.
Nov
7
comment How to print whole array in tcsh
How would that address the Word too long error?
Nov
7
comment How to print whole array in tcsh
Also posted on Stack Overflow here.
Oct
17
comment Search for a previous command with the same prefix when I press Up at a shell prompt
Or you might consider switching to bash (I did).
Oct
15
comment What does * next to the file name mean in the output of ls?
@dchirikov: It's merely a duplicate, not a copy. (The word "copy" might imply a copy-and-paste of the exact content.)
Oct
9
awarded  Announcer
Oct
8
comment What is the easiest way to add a string on the beginning of every line of the file from the command line?
@sim: It's bash 3.1.17, at least on the one I'm logged into at the moment.