[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How does Squeeze initialize PS1 ?



I'm debugging some bash scripts and reading the scripts that come as
part of Squeeze installation. I find several places where there are
statements the set a value from variable PS1, BUT all of them seem
to be in scripts that only get executed if PS1 is already non-empty.
i.e. they are after a statement 
[ -z "$PS1" ] && return
which, I think, executes return if PS1 is empty.

A related question:
The comment just before the above line of code is:
"# If not running interactively, don't do anything"

For me, the implication of this comment is that a non-empty PS1 IS
the defining characteristic of 'running interactively', but I would
have thought 'interactive' should be characterized by having a tty
attached to sysin and sysout for communication to a 'user'. 

I can imagine that a non-empty PS1 is used as an indicator, in which
case whatever code that actually sets up the tty also sets PS1 to 
some minimal non-empty value like a single space or a dot, but is
this actually the way it works, and where is it?

Where can I read about these issues?

Puzzled.
-- 
Paul E Condon           
pecondon@mesanetworks.net


Reply to: