Skip to main content
7 events
when toggle format what by license comment
Jan 24, 2020 at 17:43 review Suggested edits
Jan 24, 2020 at 17:49
Dec 8, 2015 at 23:46 comment added Matthew you are correct, in my haste when wrote this out in a single line in my bash prompt I used for i in ... and history -d $i and got the results I described in my comment above. Using $1 this absolutely is correct as stated in your original answer.
Dec 8, 2015 at 21:38 comment added Barmar @Matthew Notice that I made a similar comment to Tyler's answer. I came up with my solution as a fix for that.
Dec 8, 2015 at 21:37 comment added Barmar @Matthew That's not necessary. I'm not deleting $x each time through the loop, I'm deleting $1. So it first deletes 511,and 512 becomes 511. Then it deletes 511 again, and so on.
Dec 8, 2015 at 21:12 comment added Matthew Be sure to use the higher number for the first argument or you will delete every other command. E.g. when command 511 is deleted, everything shifts down so 512 becomes the new 511 and 513 is the new 512. Therefor history -d 511 works as expected, then history -d 512 deletes what used to be 513, and 512 remains in the history as command 511. Hope that makes sense.
Feb 7, 2013 at 12:36 history edited Barmar CC BY-SA 3.0
edited body
Feb 7, 2013 at 12:14 history answered Barmar CC BY-SA 3.0