Subscribe to

Archive for the 'Shell' Category

What’s new? Rake tasks are cached (thanks to turadb). If there is no Rakefile in the current directory, ancestor directories are searched in the way Rake itself does. Installation Copy the file to /etc/bash_completion.d or possibly /usr/share/bash-completion/completions or to another place where it is loaded when your Bash shell is started.

Bash completion for script/generate

The Rails generator script/generate knows pretty well what things it can generate. In fact, it knows much better than I do. So, I think it could really give me some help when I’m typing along on the command line. If you save the snippet below as /etc/bash_completion.d/generate you can enjoy this help, too. _generate() { […]

The gem command is the command line user interface to the RubyGems system for managing Ruby packages. This command has a few sub-commands itself and a long list of options that differ per sub-command. Remembering and typing them can be tedious, but thankfully, if you are using the bash command shell, it can help with […]

In order to keep multiple versions of a file, I sometimes add a timestamp to the filename. Doing this by hand is tedious and error-prone, but this chore can be automated by a small shell script. /usr/local/bin/timestamp #! /bin/sh for oldname ; do ts=`date +’%Y%m%d%H%M’ –reference=”$oldname”` newname=`echo $oldname | sed -nre “s/^(\\.?)([^\\.]+)(-[[:digit:]]{12})(\\..*)\$/\\1\\2-$ts\\4/p”` if [ -z […]

I’m using rsnapshot for making regular backups of my Linux box. Neither the computer, nor the external backup disk is running all the time, therefore it would not work to simply have cron run rsnapshot at fixed times. I want a little more flexibility than that. When the computer is off, there’s no point in […]

Fork me on GitHub