The effect you witnessed is due to the shell expecting another backtick. You get the same effect when you, for example, enter (
(or any other incomplete command) and press Return on the command line.
The prompt, >␣
, that you got is the secondary prompt, as stored in $PS2
. This prompt is used by the shell when more interactive input is needed to finally complete the command.
An example:
bash-4.4$ for i in {0..10..2}
> do
> printf 'Hello %d\n' "$i"
> done
Hello 0
Hello 2
Hello 4
Hello 6
Hello 8
Hello 10
bash-4.4$
bash-4.4$
is my primary prompt ($PS1
), and I get the secondary prompt when pressing Return after {0..10..2}
on the first line since the command typed in so far is not complete. I continue to get the secondary prompt on each line until I have completed the command by pressing Return after done
(which completes the input of the for-loop to the shell).
The tertiary prompt ($PS3
, usually #?␣
) is used by the select
keyword, while the quaternary1 prompt ($PS4
, usually +␣
) is used for tracing output when the shell xtrace
option is set with set -x
.
1 Yes, I had to look up that word.