Usually, no, the terminal does not pass any options to bash. bash does, however, assume a set of default options depending on how it was invoked. From man bash, section INVOCATION:
An interactive shell is one started without non-option arguments and
without the -c option whose standard input and error are both connected
to terminals (as determined by isatty(3)), or one started with the -i
option. PS1 is set and $- includes i if bash is interactive, allowing
a shell script or a startup file to test this state.
An interactive shell further activates other options.
Further some defaults apply based on the invocation name (sh vs bash). Reading on (section on set):
-h Remember the location of commands as they are looked up
for execution. This is enabled by default.
-m Monitor mode. Job control is enabled. This option is
on by default for interactive shells on systems that
support it (see JOB CONTROL above)
-B The shell performs brace expansion (see Brace Expansion
above). This is on by default.
-H Enable ! style history substitution. This option is on
by default when the shell is interactive.
Combined, simply invoking bash on a terminal will enable these options.
You can confirm this by checking the value of the $- special variable:
$ echo $-
himBH
An additional option that maybe set is if your terminal is set to start login shells. In that case -l is explicitly passed by the terminal as an option.
echo $-? Also, what exactly is$-? Links to some kind of documentation, article etc will be appreciated. – Slothworks Aug 13 '15 at 11:32$-is a variable which contains the current set of options (search for$-in the manpage). Technically, GNOME Terminal doesn't launch your shell with any options at all. But the state in which it starts (connected to a terminal, not processing a file or executing a command) makesbashassume a set of default options - the one listed above. For example, if you open a terminal and runbashmanually, it would also have these options, even though you did not use any options. – muru Aug 13 '15 at 11:36bash <some script>it could have a different set of parameters? Like you said, because of the way it was invoked. Is that right? – Slothworks Aug 13 '15 at 11:47hB. And ignore my previous comment. I meant to say: compare with the output ofbash -c 'echo $-'– muru Aug 13 '15 at 11:53bash -c 'echo $-'sayshBcwhich is lot more enlightening. Also, on a side note (probably this is best asked as a separate question too) , why is it that a script that does not have execute permissions gets executed when run asbash <script>? A brief answer is present here, but some more background and a little more elaboration would be nice. – Slothworks Aug 13 '15 at 12:03bashis. The system calls involved (seeman 3 exec) care about the permissions and type of the file being executed (bashwhen you dobash foo,./foowhen you do./foo), and not what the arguments are. It'sbashwho will worry about whether the arguments are valid or not. – muru Aug 13 '15 at 12:17