↓ Skip to main content
  1. Blog/

Adding growl notification to Raymond Page's bash prompt code

·279 words·2 mins·
Diego Zamboni
Author
Diego Zamboni

Update (2008/09/10): Giles Orr kindly pointed out that he is not the author of the bash prompt package I use, I have updated to give proper credit to the author, Raymond Page.

For some time I have used Raymond Page's bash prompt code (heavily based on the work by Giles Orr in the Bash Prompt HOWTO, you can get it at http://gentoo-wiki.com/TIP_Prompt_Magic or http://code.google.com/p/homenix/source/browse/, you need to get .prompt, .prompt_functions and .prompt_config from the trunk/ directory), which I like very much because it is highly customizable, and although a lot of the functions are Linux-specific, it can easily be made to work on Mac OS X. It features context-dependent prompt colorization (e.g. based on whether the current directory is writable and on the machine load), automatic shortening of the prompt based on window width, and many other features.

More recently, I came across this hint for producing Growl notifications for shell commands that run for more than a predefined length of time, which I find extremely useful for knowing when those commands have finished.

Because both rely on some of the same mechanisms in bash, merging them is not completely straightforward. Here's what I did:

  1. Download and install .preexec.bash as instructed in the hint.
  2. Add the preexec() function and preexec_install call to your .bashrc or .bash_login file (as instructed)
  3. Add the code from the precmd() function in the hint to the preexisting precmd() function in the .prompt file. I added it at the end. This is the main difference from what is described in the hint. I added it at the very end of the function.

That's it - a nice bash prompt with growl notifications for long-running commands.

The log: The lifeblood of your data pipeline - O'Reilly Radar

·75 words·1 min
via http://radar.oreilly.com/2015/04/the-log-the-lifeblood-of-your-data-pipeline.html Interesting article. I hadn’t heard of Fluentd, looks useful. The old paradigm — machines to humans, and the new — machines to machines. Image courtesy of Kiyoto Tamura. Over the last decade, the primary consumer of log data shifted from humans to machines. Software engineers still read logs, especially when their software behaves in an unexpected manner. However, in terms of “bytes processed,” humans account for a tiny fraction of the total consumption.

Whisky - Matt Gemmell

·51 words·1 min
via http://mattgemmell.com/whisky/ Nice essay.But then, finally, with one last branch hacked from your way, you set eyes upon it, and stand there. Silent and still. Perhaps you raise a hand, feeling time-worn stone beneath your fingertips. A dream, finally made solid. You’ve come so far, and now, at last, you’re here.