Simple script a.sh: #!/bin/bash echo "PS1: $PS1"
Variable $PS1 is present: # echo $PS1 \[\033[01;32m\]$USER@\h \[\033[00m\]\A \[\033[01;34m\]\w\[\033[00m\]\$ Variable $PS1 is environment: # env | grep PS1 PS1=\[\033[01;32m\]$USER@\h \[\033[00m\]\A \[\033[01;34m\]\w\[\033[00m\]\$ Executing script: # ./a.sh PS1: Variable PS1 is empty in child process. Whether the enviroment variable should not be copied to the child process? Am I doing something wrong? Popular methods to test if shell is interactive or not don't work for me: 1. case "$-" in *i*) echo This shell is interactive ;; *) echo This shell is not interactive ;; esac 2. if [ -z "$PS1" ]; then echo This shell is not interactive else echo This shell is interactive fi -- View this message in context: http://old.nabble.com/test-if-shell-is-interactive-tp33183345p33183345.html Sent from the Gnu - Bash mailing list archive at Nabble.com.