The Python Image Library, a spectrum ROM, and Wayne Schmidt’s pixel page, and a 35 year old geek, and what do you get?
Speccy Gifs! That’s what.
Well, blimey, this has been an interesting n weeks, where n>5. Did 20-odd hours over the weekend, and haven’t had a two-day weekend as far back as I can remember, which is only 10 hours on account of having a frazzled brain. Last night I was in t’office trying to fix a test and write some documentation, but then I found I couldn’t type simple words like “simle”.
Now I know what it feels like to be a junior doctor.
Worster than that, I know that our sick people are in the hands of people too zonked to spell “simle” properly.
This is a three-part solution to something I’ve always wanted to do but never applied myself to. Doubtless there will be a dozen better ways to do it that have remained hidden until I solved it myself.
The aim is to start a new bash session in a directory of your choice, but keeping all your nice personal settings.
My environment: I have cygwin and console2, though you can use any terminal you like.
The key to the whole shebang is clip.tgz. A simple command-line clipboard reader and writer for cygwin. clip -p to write the clipboard to stdout, clip -c to get stdin onto the clipboard.
Next up: pastedir.sh
#!/usr/bin/bash
candidate="`clip -p`"
if [ -d "$candidate" ]
then
pushd “$candidate”
fi
I put this in ~/bin
Finally, I add the following line to .bash_profile:
. bin/pastedir.sh
The result: whenever a bash session starts, if there’s a directory on the clipboard, the bash prompt starts in that directory.
To start in a directory, I swipe its name and hit ^T in console. Console starts a new window, and bash spots the directory and changes to it.
Todo:
- Accept forward and backward slashes
- Right now the dir must be absolute, or relative to home. Would be nice to somehow take the current directory into account.
