I looked up the shell builtin command set by typing help set
, and the short syntax description shows:
set [-abefhkmnptuvxBCHP] [-o option-name] [–] [arg …]
The help-documentation explains, that the variable $- holds all current parameters set with the set command.
So, I did echo $-
to display all parameter settings of the shell and mine was:
himBH
All of the letters are mentioned inside the documentation and the short syntax description from above, but one is missing: the i option. What does the i
set
parameter mean in bash?
Best Answer
The
i
there means the shell is interactive.This is described in the manpage section discussing the circumstances in which the shell is interactive:
The interactive nature of the shell is determined during initialisation, and its effects don’t change during the shell’s lifetime; this is why
set
doesn’t reporti
as a flag that can be altered. In version 4.3 of Bash,set -i
orset +i
are accepted, but don’t have any effect beyond altering theforced_interactive
flag internally (and this flag is only read during initialisation). In version 4.4 they produce an error message. You can see the details of flag handling inflags.c
in the Bash source code.