Ensure persistent history exists
This commit is contained in:
parent
f6b76ee9d1
commit
f4a32f1a69
@ -64,6 +64,10 @@ log_bash_persistent_history()
|
|||||||
]]
|
]]
|
||||||
local date_part="${BASH_REMATCH[1]}"
|
local date_part="${BASH_REMATCH[1]}"
|
||||||
local command_part="${BASH_REMATCH[2]}"
|
local command_part="${BASH_REMATCH[2]}"
|
||||||
|
# Ensure file exists
|
||||||
|
if ! [ -w "$(dirname ${PERSISTENT_HISTFILE})" ]; then
|
||||||
|
mkdir -p $(dirname ${PERSISTENT_HISTFILE})
|
||||||
|
fi
|
||||||
if [ "$command_part" != "$PERSISTENT_HISTORY_LAST" ]
|
if [ "$command_part" != "$PERSISTENT_HISTORY_LAST" ]
|
||||||
then
|
then
|
||||||
echo $date_part "|" "$rc" "|" "$command_part" >> "${PERSISTENT_HISTFILE}"
|
echo $date_part "|" "$rc" "|" "$command_part" >> "${PERSISTENT_HISTFILE}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user