The script can be found here: https://stackoverflow.com/questions/14750650/how-to-delete-history-of-last-10-commands-in-shell
For convenience here it is:
for x in `seq $1 $2` do history -d $1 done
I put this in my include directory (one which I've added to the PATH) where I run many other scripts I've written and work just fine.
This does not produce the desired result of deleting rows from my history, in fact it does nothing at all.
Any idea why the history command doesn't work? I'm wondering if it has something to do with the directories.
I played around with the code and tried different variations. If I put an
echo in front of the
history command and run it, I get the following output:
cgravel@scspc578:~$ idelhistory 300 305 history -d 300 history -d 301 history -d 302 history -d 303 history -d 304 history -d 305 cgravel@scspc578:~$
So, to me, it seems like it should work perfectly. I can't figure out why. This script is being run from /$HOME/Scripts/ and it has been included in the PATH. I also tried running it with sudo and nothing changes.
$1is definitly wrong!! it has to be
$x. you would try to remove the start number