From f770c0be5c448fef3d57ef0b2ff9735dc779a142 Mon Sep 17 00:00:00 2001 From: Brad Bowman Date: Thu, 4 Jul 2013 21:30:01 +1000 Subject: [PATCH 1/2] PROMPT_COMMAND "\t" handling Append the output of a group command to .bash_eternal_history to avoid the history output getting interpreted by echo -e. Added -n to echo to maintain the format. PROMPT_COMMAND='{ echo -ne ...; history 1 }>>~/.bash_eternal_history'' --- .bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 9b806c272..6853328ec 100644 --- a/.bashrc +++ b/.bashrc @@ -139,7 +139,7 @@ if [ "$PS1" ]; then # define a bash function which escapes the string before writing it; if you # have a fix for that which doesn't slow the command down, please submit # a patch or pull request. - PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo -e $$\\t$USER\\t$HOSTNAME\\tscreen $WINDOW\\t`date +%D%t%T%t%Y%t%s`\\t$PWD"$(history 1)" >> ~/.bash_eternal_history' + PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'{ echo -ne $$\\t$USER\\t$HOSTNAME\\tscreen $WINDOW\\t`date +%D%t%T%t%Y%t%s`\\t$PWD; history 1; } >> ~/.bash_eternal_history' # Turn on checkwinsize shopt -s checkwinsize From 4228451409075b067bb4f74709a61f273c5200ef Mon Sep 17 00:00:00 2001 From: Brad Bowman Date: Thu, 4 Jul 2013 21:33:37 +1000 Subject: [PATCH 2/2] Remove PROMPT_COMMAND escaping comment --- .bashrc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.bashrc b/.bashrc index 6853328ec..ca5780448 100644 --- a/.bashrc +++ b/.bashrc @@ -134,11 +134,6 @@ if [ "$PS1" ]; then # 5) current working directory (to see where a command was executed) # 6) the last command you executed # - # The only minor bug: if you include a literal newline or tab (e.g. with - # awk -F"\t"), then that will be included verbatime. It is possible to - # define a bash function which escapes the string before writing it; if you - # have a fix for that which doesn't slow the command down, please submit - # a patch or pull request. PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'{ echo -ne $$\\t$USER\\t$HOSTNAME\\tscreen $WINDOW\\t`date +%D%t%T%t%Y%t%s`\\t$PWD; history 1; } >> ~/.bash_eternal_history' # Turn on checkwinsize