From https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html,
-
(A hyphen.) Expands to the current option flags as specified upon invocation, by the set builtin command, or those set by the shell
itself (such as the -i option).
I am not sure what it says. Can you give some examples for the meaning of a hyphen parameter?
Best Answer
You can
echo $-
to see the currently-enabled shell options:Those are options you can provide with a
-
on shell invocation —bash -h -B
— or later on usingset
.The flags are defined in the documentation for
set
. My options above are:and
i
for an interactive shell.If I change the active options, say with
set -x
, I'll get a new value of$-
: