history -s
^ Command will add to history. However, it will also not allow the callee function to remain in the history.
To clarify with example:
When we have a function:
history.demo() {
echo "args: $@"
history -s "echo HI WORLD"
}
export -f history.demo;
And call this function in terminal
history.demo 1 a
What I would like to see saved in the history is
history.demo 1 a
echo HI WORLD
However, what I do see is only
echo HI WORLD
How can we get the original and the add-on into bash history?
Looks like the following is doing the trick (thank you r2evans@ for the pointer)