Open nisbet-hubbard opened 1 month ago
Hm I'm not familiar with this feature -- can you give a repro?
If it can be tickled with $SH -i -c 'some shell code'
then it could go in our spec tests, and is more likely to be fixed
Sure. Here’s the flow to reproduce it:
# in bash
$ HISTTIMEFORMAT='%c '
$ history -a # now a couple of timestamp lines get appended to the bottom of HISTFILE
$ osh
# in osh
$ history -r
# assuming bash and osh share the same HISTFILE, the same timestamp lines
# are now appended to the bottom of osh’s history list; next, scroll back through
# history and you see timestamps like this appear on the command line as if
# they were commands:
$ #1727682500
Because
HISTTIMEFORMAT
hasn’t been implemented yet, a side effect is osh doesn’t parse bash’s history comment character correctly. So, when the two share a history file, osh treats #timestamp lines as commands to be shown to the user on the command line.The only workaround appears to be to turn off
HISTTIMEFORMAT
on bash’s side.I suppose the use case of sharing history file between the two shells is reasonably common, especially when one’s still trying out osh. And just like we use an alias of
history -a; history -c; history -r
to easily sync history between parent and child bash shells, one would naturally want to be able to do the same between osh and bash.