bashやzshで、historyに任意のコマンド…というか文字列を実行せずに追記したい場合。 それぞれ、以下のコマンドで行うことができるようだ。

bash
history -s string # bashの場合 print -S string # zshの場合

shell
blacknon@BS-PUB-UBUNTU-01:~$ history | tail 1628 rm -rf ./* 1629 clear 1630 ls 1631 echo aaa | tee test{01..20}.txt >& /dev/null 1632 ls 1633 grep '' ./* 1634 clear 1635 cd 1636 clear 1637 history | tail blacknon@BS-PUB-UBUNTU-01:~$ history -s aaaa blacknon@BS-PUB-UBUNTU-01:~$ history | tail 1630 ls 1631 echo aaa | tee test{01..20}.txt >& /dev/null 1632 ls 1633 grep '' ./* 1634 clear 1635 cd 1636 clear 1637 history | tail 1638 aaaa 1639 history | tail