Saving current directory to bash history

后端 未结 9 1963
时光取名叫无心
时光取名叫无心 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条回答
  •  孤街浪徒
    2020-11-28 20:10

    You could consider an independent project (I wrote it) that supports saving the path for each command: https://github.com/chrissound/MoscoviumOrange

    Where you can add a hook into Bash to save each entry with:

    $(jq -n --arg command "$1" --arg path "$PWD" '{"command":$command, "path":$path}' | "$(echo 'readlink -f $(which nc)' | nix run nixpkgs.netcat)" -N -U ~/.config/moscoviumOrange/monitor.soc &)
    

提交回复
热议问题