Re: FVWM: fvwm2/twm losing PS1 (environment experiment results)

From: Paul D. Smith <psmith_at_BayNetworks.COM>
Date: 02 Nov 1998 22:52:00 -0500

%% "Jose' Manuel Pereira" <jmp_at_asterix.ist.utl.pt> writes:

  jmp> But the recommended bash trick for detecting a non-interactive
  jmp> shell is '[ -z "$PS1" ]'!!

Recommended by whom? :)

The _correct_, always completely accurate, way to test for interactivity
in ksh, bash, and zsh is to test the $- option variable to see if it
contains "i" or not.

  case "$-" in
    *i*) echo "Interactive!" ;;
    *) echo "Not interactive!" ;;
  esac

See the man page.

The _only_ reason to use PS1 is if you must maintain backward
compatibility with older Bourne shells. This should really never be
much of a concern in places where you'd expect to see this type of test.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith_at_baynetworks.com>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Mon Nov 02 1998 - 21:55:44 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:38:01 BST