From 060c48487ee1e00a3f2bf2cd9d0853221d647d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Thu, 28 Apr 2016 09:45:44 +0800 Subject: [PATCH] Sourcing by the script name itself --- bash/bashrc/rbashrc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bash/bashrc/rbashrc b/bash/bashrc/rbashrc index ffe0722..263c631 100644 --- a/bash/bashrc/rbashrc +++ b/bash/bashrc/rbashrc @@ -4,6 +4,8 @@ case $- in *) return;; esac +__SCRIPT=$( pwd )$BASH_SOURCE + # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc @@ -137,7 +139,7 @@ function __uuid { } function rbash_upgrade { - echo "Updating the .bashrc" + echo "Updating $__SCRIPT" __uuid TMPID TMPFILE=/tmp/$TMPID __download "http://git.astropenguin.net/?p=utils.git;a=blob_plain;f=bash/bashrc/rbashrc;hb=HEAD" > $TMPFILE @@ -167,8 +169,8 @@ function rbash_upgrade { -e "s/$COLOR_CODE_TOK/$COLOR_CODE/g" \ $TMPFILE - mv $TMPFILE ~/.bashrc - . ~/.bashrc + mv $TMPFILE $__SCRIPT + . $__SCRIPT } function rbash_run {