On Fri, Mar 12, 2010 at 12:39 PM, Pierre Gaston <pierre.gas...@gmail.com>wrote:
> > > On Fri, Mar 12, 2010 at 12:15 PM, Ken Irving <ken.irv...@alaska.edu>wrote: > >> On Fri, Mar 12, 2010 at 11:57:41AM +0200, Pierre Gaston wrote: >> > On Fri, Mar 12, 2010 at 11:50 AM, Ken Irving <ken.irv...@alaska.edu> >> wrote: >> > >> > > On Fri, Mar 12, 2010 at 09:16:05AM +0000, Marc Herbert wrote: >> > > > >> Could this sentence: >> > > > >> >> > > > >> "An interactive shell is one started without non-option >> arguments, >> > > > >> unless -sis specified, without specifying the >> > > > >> -c option, and whose input and error output are both connected to >> > > terminals >> > > > >> (as determined by isatty(3)), or one started with the -i option. >> " >> > > > >> >> > > > >> be any more confusing? >> > > > > >> > > > > Is seems pretty clearly stated to me. >> > > > >> > > > Please enlighten us with the priority of English boolean operators. >> > > > >> > > > I have never seen a natural language sentence with so many boolean >> > > operators. >> > > >> > > Well I can try. >> > > >> > > An interactive shell is one started without non-option arguments, >> > > >> > > If there are any arguments then they must be options... >> > > >> > > unless -s is specified, >> > > >> > > bash(1) says: "If the -s option is present ... then commands are read >> > > from the standard input", which clearly is not interactive. >> > > >> > >> > If you run "bash -s foo bar" in a terminal it starts an interactive >> shell. >> >> Maybe the definition isn't correct, then, if your example is at odds >> with the first two statements. The -s is accompanied by foo, and bar >> is a non-option argument. I would think that 'foo' would executed as >> a command, and the the file bar would be run as a script; I don't see >> how this would be interactive, though. >> >> Ken >> > The definition is correct but maybe not too clear. > "unless -s is specified" means that the first rule is true unless you use > -s ie you can include non option argument > if you use -s and still have an interactive shell, so bash -s foo bar is > interactive (if connected to a terminal) > > In fact this clearly stated in the ref manual "The -s invocation option > may be used to set the positional parameters when an interactive shell is > started." > > The role played by -c is the definition is less clear to me since with -c > you must give a non option argument and thus the "non-interactivity" is > probably covered by the first rule > and I don't think you can use both -s and -c at the same time. (well you > can put both but the first one to appear disables the parsing of the second > one) > ah, I found a way to specify both -s and -c : bash -c -s 'echo $-' foo bar