USER=jdoe eval "USERHOME=~$USER"
At $WORK I've just switched to using Foswiki (formerly TWiki) for documentation. I miss editing files directly from Emacs like you can with Confluence, but I'll get over it. The main reason I like Foswiki is that, at heart, the source files are plain text, and are available as plain text -- no need to trawl through a database.
Another nice feature that Confluence has is the ability to export a space (Foswiki calls it a web) directly as PDF. A bit of scripting takes care of that, but since this is the second time I've lashed together a Makefile to generate a PDF from Foswiki, I figure it's time to post it.
You can find the Makefile here. It uses lynx, wget and htmldoc; of those, I suppose only htmldoc is hard to replace. There's one important assumption built into the Makefile, though: that every page is linked to from the front page of the web, which is how I organize my pages.
Update: Just showed the boss the printed version, and he was very impressed. Yay me! :-)
I dreamt last night that I met Sammy Davis Junior and talked to him to release all of his songs under a Creative Commons license 20 years after his death.
"Hugh, I'm convinced," he said. "And I want to write a cheque for ten thousand dollars, too. Tell me which organization to give it too."
(I think I also piqued RMS's interest in the issue, too, but I can't remember that part.)
In other news, my old employers have been bought by another BC ISP. I can't say I'm surprised, but it's a shame the new company uses IIS for their webserver...yeah, I'm a Unix geek, all right.
And many thanks to tobutaz for providing a much better answer to the question "How do I get the home directory of a user whose name is in a variable?":
USER=jdoe eval "USERHOME=~$USER"
Every now and then I'm reminded of eval and then forget it when it's useful. Thanks again, tobutaz!
Not the clearest title...what I mean is, I was writing a Bash script like this:
SOMEONE=foo ... mv $SOMETHING ~$SOMEONE
only it kept failing with "~foo: No such file or directory". I had a look at the manual, but it wasn't terribly clear. In a nutshell, though, Bash wasn't doing the tilde expansion no matter what combination of braces and quotes tried.
Eventually, I came across a pirated copy of the ever-excellent Unix Power Tools, 3rd Ed. (mine's at work, or I'd've checked it a lot sooner), and it had a solution:
FINAL_RESTING_PLACE=$(/bin/bash -c "echo ~${SOMEONE}")
I'm sure there must be a better way of doing this, though...Woot, any suggestions?
It astounds me that, until a couple of days ago, I did not know about Bash's help
or declare
functions.
Wout's back! This time, he's got an entry about running functions under sudo. Not only is this going into my .bashrc, but I've got some reading to do about command and Bash's getopts. (I had looked at getopts in Bash before, but I remember the example code being pretty Byzantine; it was enough to put me off using getopts in Bash at all. This looks much more reasonable.)
Incidentally, I'm writing this on the Linode node/machine/whatever, and there's noticeable lag. The CPU graph on the member's page says there's medium load; web server performance seems to be quite fine, so I'm not sure it's bandwidth. I mention it because this is the first time that's happened; so far, I've been very happy with Linode performance.