fix: handle newlines
This commit is contained in:
parent
1dc3e8842f
commit
2394cfdd86
|
|
@ -18,7 +18,9 @@ histcmd_dir="$HOME/dev/vlv/shell-history"
|
|||
|
||||
_add_history() {
|
||||
if test "$(id -u)" -ne 0; then
|
||||
echo "$(date --utc --iso-8601=seconds) $(hostname) $(pwd) $(fc -ln -1)" >> $histdb_dir/zsh-history-$(date "+%Y-%m-%d").log;
|
||||
local cmd=$(fc -ln -1)
|
||||
cmd=${cmd//$'\n'/\\n}
|
||||
echo "$(date --utc --iso-8601=seconds) $(hostname) $(pwd) $cmd" >> $histdb_dir/zsh-history-$(date "+%Y-%m-%d").log;
|
||||
fi
|
||||
}
|
||||
add-zsh-hook precmd _add_history
|
||||
|
|
|
|||
Loading…
Reference in a new issue