[arch-commits] Commit in bash/trunk (bashrc system.bashrc)

Allan McRae allan at archlinux.org
Tue Jan 4 15:09:59 UTC 2011


    Date: Tuesday, January 4, 2011 @ 10:09:59
  Author: allan
Revision: 104606

check for interactive session before sourcing bashrc

Modified:
  bash/trunk/bashrc
  bash/trunk/system.bashrc

---------------+
 bashrc        |    5 ++---
 system.bashrc |   11 +++--------
 2 files changed, 5 insertions(+), 11 deletions(-)

Modified: bashrc
===================================================================
--- bashrc	2011-01-04 15:03:46 UTC (rev 104605)
+++ bashrc	2011-01-04 15:09:59 UTC (rev 104606)
@@ -1,6 +1,5 @@
+# If not running interactively, don't do anything
+[[ $- != *i* ]] && return
 
-# Check for an interactive session
-[ -z "$PS1" ] && return
-
 alias ls='ls --color=auto'
 PS1='[\u@\h \W]\$ '

Modified: system.bashrc
===================================================================
--- system.bashrc	2011-01-04 15:03:46 UTC (rev 104605)
+++ system.bashrc	2011-01-04 15:09:59 UTC (rev 104606)
@@ -1,15 +1,10 @@
 #
 # /etc/bash.bashrc
 #
-# This file is the systemwide bashrc file. While most of the
-# environment is preserved when running an interactive shell
-# the PS[1-4] variables, aliases and functions are reset.
-#
-# When running a non-login shell, apply the following settings:
-# - Prompt defaults (PS[1-4], PROMPT_COMMAND)
-# - bash_completion if it exists
-# - source /etc/bash.bashrc.local
 
+# If not running interactively, don't do anything
+[[ $- != *i* ]] && return
+
 PS1='[\u@\h \W]\$ '
 PS2='> '
 PS3='> '




More information about the arch-commits mailing list