I want to make a simple script to delete a line from bash_history
, based on user input of the line number.
echo -n "Delete History Line Number: "
read num
history -d $num
The error is "history position out of range" (which it shouldn't be, I'm using a number within range).
Why doesn't this work?
Best Answer
There are two reasons why your script will not work as intended:
Depending on your use case the easiest solution might be to source the script, instead of executing. See the SU post explaining the difference of sourcing and executing for more information.