bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (feature request) separate history for each folder / folder related


From: Chris F.A. Johnson
Subject: Re: (feature request) separate history for each folder / folder related history
Date: Thu, 7 Jul 2005 21:44:04 -0400 (EDT)

On Thu, 7 Jul 2005, Jochen Baier wrote:

hi,

do you already thought about to have a folder related history ?

for example:

in folder: code/superprogram: i use the commands: make, ./superprogram

in folder: code/homepage: i use "scp index.html ksdjf@kjsfk...." to upload

the next day, i go to "code/superprogram" folder and the bash history will show "make and ./superprogram" and in "code/homepage" arrow up key will show "scp.."

would love to have something like that.

   Untested; adjust to taste:

cd()
{
  builtin cd "$1" &&
   if [ ./.bash_history ]
   then
      history -c
      history -r ./.bash_history
      HISTFILE=./.bash_history
   fi
   case $PROMPT_COMMAND in
      *history\ -a*) ;;
      *) PROMPT_COMMAND="$PROMPT_COMMAND; history -a" ;;
   esac
}

export -f cd

--
    Chris F.A. Johnson                     <http://cfaj.freeshell.org>
    ==================================================================
    Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
    <http://www.torfree.net/~chris/books/cfaj/ssr.html>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]