Wed 03 February 2016

Searching bash history when it's in multiple files

When I look for previous commands that I have ran in bash, I use history | grep COMMAND. That works well when you're history is in one file, but I now save my history in multiple files from each shell and my simple command doesn't work.

With my history files saved …

Thu 28 January 2016

A bash script to check domain expirations

I have a bad habit, and that's of buying domain names. I have about 20, with several different registrars. If I was smart, I would consolidate them under one registrar, but, even then, checking expirations on the domains is a pain. I usually have autorenew turned on, but I still …

Tue 26 January 2016

Fixing my .taskpaper reset alias for bash

There was a little problem with my alias to reset a .taskpaper list by removing all of the @dones. It didn't remove any spaces before the @done, so each line would gain a space every day. This fixes it:

alias rst="sed -i '' 's/ *@done\(.*\)//g'"

Now it removes one …

Sat 23 January 2016

Using a Here Document with bash and MySQL

This past week I worked on a bash script to create some input files from a MySQL database. My problem was trying to use multiple line MySQL statements, which was messing everything up. The solution was to use bash's Here Documents. It's a way to direct lines into a command …

Fri 22 January 2016

Resetting a daily taskpaper list

I have a couple daily taskpaper lists that by the end of the have an @done on each line and I need to reset it for the next day. Instead of trying to do a search and replace everyday, I added a bash alias to .bash_profile (or .bashrc):

alias rst …

Thu 21 January 2016

Saving bash shell history for multiple shells

The history from the commands typed into bash are very useful from time to time, especially when I think "Oh, I'll remember that command next time I need it", and then I don't. The problem with bash's history are twofold:

  • It only saves history when the terminal exits cleanly, so …

Mon 18 January 2016

Resetting a .taskpaper file

I use a couple of .taskpaper files for checklists of things that need to be done every day. In it, after a task is completed the task gets an @done tag added. But the next day I want to start fresh. I could do a find/replace, but sed at …