]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
bash: Abort if the shell is not interactive.
authorSimon Ruderich <simon@ruderich.org>
Thu, 12 Mar 2009 21:42:51 +0000 (22:42 +0100)
committerSimon Ruderich <simon@ruderich.org>
Thu, 12 Mar 2009 21:43:33 +0000 (22:43 +0100)
Prevents problems with scp and rcp.

bash/rc

diff --git a/bash/rc b/bash/rc
index 3e17648afa8fcf10da45358bcb771a7ef7debe77..7c1a6e7914bdda727e3105bbeb90e338c9fbb124 100644 (file)
--- a/bash/rc
+++ b/bash/rc
@@ -24,6 +24,13 @@ source_debug "sourcing ~/.bash/rc"
 source_config ~/.shell "" env $host
 
 
+# Check if this is an interactive shell. Abort if not to prevent problems with
+# scp and rcp. Taken from default Debian bashrc. Thanks.
+if [[ $- != *i* ]] ; then
+    return
+fi
+
+
 # Set the prompt; hostname and current working directory are displayed.
 # Hostname is displayed in green, current directory in blue.
 PS1='\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \$ '