Skip to content

Commit

Permalink
more error resilient
Browse files Browse the repository at this point in the history
  • Loading branch information
mfiers committed Apr 4, 2011
1 parent 1b29553 commit ade5aa2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions bin/moa_prompt
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/bash

function _moa_prompt {
function _moa_prompt_2 {


#Get the last command
#based on:
#http://stackoverflow.com/questions/945288/...
# ...saving-current-directory-to-bash-history
#
local lc=$(history 1)
lc="${lc# *[0-9]* }"

#save the last command to a user specific location
echo $lc > ~/.moa.last.command

Expand Down Expand Up @@ -78,3 +80,17 @@ function _moa_prompt {
fi
echo -e "${gray}...Moa/${blue}${template}${gray}. ${status}${gray}${timing}${reset}"
}

function _moa_prompt {
# two step procedure - here we define a trap & call
# the second function..
function errex() {
return 0
}
trap "errex" ERR

_moa_prompt_2 2>/dev/null

trap - ERR
}

0 comments on commit ade5aa2

Please sign in to comment.