Saving current directory to bash history

后端 未结 9 1955
时光取名叫无心
时光取名叫无心 2020-11-28 19:29

I\'d like to save the current directory where the each command was issued alongside the command in the history. In order not to mess things up, I was thinking about adding

9条回答
  •  旧时难觅i
    2020-11-28 20:18

    Full disclosure: I'm the author of the FOSS-tool
    shournal - A (file-) journal for your shell:
    Using it's bash integration, the working directory of a command is also stored within shournal's sqlite-database and can be retrieved via

    shournal --query -cmdcwd "$PWD"
    

    Querying for sub-working-directories can be done with

    shournal --query -cmdcwd -like "$PWD/%"
    

提交回复
热议问题