diff --git a/.rvmrc b/.rvmrc
index 28dde3d219b3a8a2b61be065d93361800cb86796..387a9797cd372073a7f48254585ed030056f1549 100644
--- a/.rvmrc
+++ b/.rvmrc
@@ -1,6 +1,11 @@
 #!/bin/bash
 
-root=$(dirname $(readlink -e $BASH_SOURCE))
+if [ -n "${BASH_SOURCE}" ]; then
+ root=$(dirname $(readlink -e $BASH_SOURCE))
+else
+  root="."
+fi
+
 if [ -e "${root}/.rvmrc_custom" ]; then
   source ${root}/.rvmrc_custom
 else