On Sun, Feb 13, 2005 at 03:25:18PM +0100, Marco d'Itri wrote:
> On Feb 13, Gerrit Pape <[EMAIL PROTECTED]> wrote:
> > On Sat, Feb 12, 2005 at 02:56:51PM +0100, Marco d'Itri wrote:
> > > Checking if $PS1 is defined is a popular way to determine if a shell is
> > > an interactive shell, or a program has been started from an interactive
> > > shell. But dash always sets the variable.
> > I cannot read from the standards that $PS1 must not be set in a
> > non-interactive shell; I found posh and ksh behave the same as dash.
> Even if it's not a standardized behaviour, I think that it's still a
> popular behaviour worth supporting.
> 
> > A reliable way to check whether a shell is interactive or not is to look
> > for the options flag character i in $-.
> This does not work for scripts run from the shell.

Do you have an example where such a test on $PS1 is used?  I'm unsure
whether it's good to encourage such behavior if it's not based on any
standard, and works only with a few shells.

Thanks, Gerrit.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to