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.

-- 
ciao,
Marco

Attachment: signature.asc
Description: Digital signature

Reply via email to