I am using oh-my-zsh with the following history configuration:
setopt appendhistory autocd extendedglobsetopt EXTENDED_HISTORYsetopt histignoredups sharehistory
The history search Ctrl+R and arrow keys are set to the defaults, i.e:
% bindkey '^r'"^R" history-incremental-search-backwar
However, since a while, I am facing an issue that when searching the history for commands, I get the first line of the command with double backslash at the end, but not the other lines. In fact, this only happens when the history file is updated, if the command is fresh and I search for it on the same shell that I've entered it, I will get it correctly, but if I close the shell and reopen it, and try to retrieve the command from history, I will get it like:
-> input command:
echo \"multi-line command"
result when using history search (bck-i-search: echo
):
echo \
Does anyone know what may be causing this? The information I found here and elsewhere did not help :(
Next I add an excerpt of my history:
4453* cd place 4454* someCommand -d folder \\ 4455* --opt 1 \\ 4456* -foo1 bar1 -foo2 bar2 -aeps 0 0.01 0.01 >&! output.log & 4457* du -sh 4460* ls * 4461* exit
zsh version for the two hosts which are failling: 5.0.2 and 5.0.5.
Then I added one multiline command due to syntax:
3723 echo $ZSH_VERSION 3724 for x in 1 2 3; do echo $x \ndone 3725* someCommand -d folder \\
which is working fine. A multiline quotation, as in:
echo "laladquote> dumpdquote> dumpdquote> ok"
resulting in:
3732 echo "lala\ndump\ndump\nok"
and which also working fine.
This is not happening on my local machine (zsh version 5.0.7), which also results in multiline commands with \n instead of double \:
15365 echo \\n multi \\n line \\n command
And also in another remote server (4.3.11):
14133 example -d folder \\n -pp mpp \\n -c mcc \\n -x mxxz \\n -r mrr \\n -e 0 \\n -o out \\n -debug
In all machines I use the same configuration files.