This has nothing to do with you installing nushell
. It also does not stop the shell from functioning correctly.
The >
is the default value of the shell's secondary prompt (PS2
). The secondary prompt is displayed whenever the shell requires further input after the user has pressed the Enter key without completing the current command. This happens only when the shell is in interactive mode.
The POSIX standard says this about PS2
:
Each time the user enters a <newline>
prior to completing a command line in an interactive shell, the value of this variable shall be subjected to parameter expansion and written to standard error. The default value is >
.
In your specific example, the function definition is the command that still needs to be completed. It's not until the user enters the closing curly brace, }
, at the end of the definition that the shell can execute the command.
You will also get the secondary prompt if you are pasting in the commands in the bash
shell if "bracketed paste" has been disabled for the Readline library. By default, the bracketed paste mode is enabled, meaning the shell will process a pasted chunk of text in one go rather than as individual lines. This behaviour may be disabled (for future shell sessions) by adding the following line to your ~/.inpturc
file:
set enable-bracketed-paste off
Bracketed paste mode is also disabled by default if the terminal is "dumb" or if you are using a release of the bash shell older than 5.0.
Different shells may have a different default value in $PS2
. The zsh
shell, for example, lets you know what command is currently not complete by dynamically updating the prompt:
$ function foo {
function> for arg do
function for> print -r $arg
function for> done
function> }
$ foo 1 2 3
1
2
3
... while the bash
shell uses a static >
string:
$ function foo {
> for arg do
> printf '%s\n' "$arg"
> done
> }
$ foo a b c
a
b
c
The nushell
shell seems to use :::
as its equivalent to the secondary prompt in POSIX-like shells. However, the nushell
shell does not even attempt to be a POSIX shell.
Unsetting the PS2
variable in bash
would potentially lead to confusion. For example, if you think you have just invoked a long-running command but have in fact forgotten a closing quotation mark, you would not have any indication that the shell was waiting for you to complete the command.