Separating the first part of a list and the `alert` part with && (or any
of the doubled control operators) will result the second character to be
printed in the body of the message. Adding the asterisk after the [;&|]
bracket expression fixes it.

alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal
|| echo error)" "$(history|tail -n1|sed -e
'\''s/^\s*[0-9]\+\s*//;s/[;&|]*\s*alert$//'\'')"'

Bug #1953151

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/616028

Title:
  add an "alert" alias, which can optionally be added after long running
  commands

Status in bash package in Ubuntu:
  Fix Released

Bug description:
  Binary package hint: bash

  This bug is closely related, though slightly different from Bug
  #315932.

  I recently posted:
  
http://blog.dustinkirkland.com/2010/07/dear-command-line-please-ping-me-when.html

  This post received some positive feedback in the comments and in IRC.
  A number of people have asked for this sort of functionality in the
  default Ubuntu .bashrc.  I think this is a perfectly reasonable
  request.  It doesn't get in the way, as current users must consciously
  append "; alert" onto their long running commands.

  We can experiment with this as a proof-of-concept in Maverick, and
  perhaps look at better ways of doing this automagically by default
  (again, see the really interesting implementation in Bug #315932).

  I have tested:
   a) when libnotify-bin is not installed -- command-not-found prints a useful 
error message
   b) when gnome-terminal is not installed -- icons aren't present; notify 
message pops up without icons;  still functional
   c) over ssh -X -- works fine, assuming the client and host has the necessary 
packages to do libnotify stuff

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/616028/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to