]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
Use . instead of source to load config files.
authorSimon Ruderich <simon@ruderich.org>
Fri, 20 Feb 2009 20:04:25 +0000 (21:04 +0100)
committerSimon Ruderich <simon@ruderich.org>
Fri, 20 Feb 2009 20:04:25 +0000 (21:04 +0100)
This prevents a possible security problem with source, as it also searches the
current directory.

bash/rc
shell/env
zsh/env

diff --git a/bash/rc b/bash/rc
index 942ac8d957b144b9bca9d36c6c2bd7a957bd3004..d03d05e2f155142e9eb3958c6d8f92a09e1e6c86 100644 (file)
--- a/bash/rc
+++ b/bash/rc
@@ -6,7 +6,7 @@ host=$(echo $(hostname) | sed -e 's/\..*$//')
 
 # Load environmental related settings used by all shells.
 if [ -f ~/.shell/env ]; then
-    source ~/.shell/env
+    . ~/.shell/env
 # Fallback functions as ~/.shell/env couldn't be loaded.
 else
     function source_debug() {
index 595115370245783eb67c48ae970aff3e880bcbf8..9a31ff32a44258cbdc548748f91155ca22d1134c 100644 (file)
--- a/shell/env
+++ b/shell/env
@@ -107,13 +107,13 @@ function source_config() {
     # If the file does exist then source it.
     if [ -f $source_file ]; then
         source_debug "source_config(): -> sourcing $source_file"
-        source $source_file
+        . $source_file
 
     # Otherwise load the .local file if it exists and .local files are
     # allowed.
     elif [ -f $source_file_local -a x$5 != xnolocal ]; then
         source_debug "source_config(): -> sourcing $source_file_local"
-        source $source_file_local
+        . $source_file_local
     else
         source_debug "source_config(): -> neither exists"
     fi
diff --git a/zsh/env b/zsh/env
index 365c01bfe8a172431d0d0e48b0618c42743fdeb6..a413b57c0506a31b1124cb17c8233e4cd2e8da3b 100644 (file)
--- a/zsh/env
+++ b/zsh/env
@@ -6,7 +6,7 @@ host=${$(hostname)//.*/}
 
 # Load environmental related settings used by all shells.
 if [[ -f ~/.shell/env ]]; then
-    source ~/.shell/env
+    . ~/.shell/env
 # Fallback functions as ~/.shell/env couldn't be loaded.
 else
     function source_debug() {