Quantcast
Channel: How to delete history of last 10 commands in shell? - Stack Overflow
Viewing all articles
Browse latest Browse all 23

Answer by Tyler Jandreau for How to delete history of last 10 commands in shell?

$
0
0

edit:

Changed the braced iterators, good call. Also, call this function with a reverse iterator.

You can probably do something like this:

#!/bin/bashHISTFILE=~/.bash_history   # if you are running it in a                            # non interactive shell history would not work elseset -o historyfor i in `seq $1 $2`;do    history -d $idonehistory -w

Where you will evoke like this:

./nameOfYourScript 563 514

Notice I haven't put any error checking in for the bounds. I'll leave that as an exercise to the reader.

see also this question


Viewing all articles
Browse latest Browse all 23

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>