more robust initialization, remove old func
authorIan Kelling <ian@iankelling.org>
Wed, 18 Jan 2017 22:16:48 +0000 (14:16 -0800)
committerIan Kelling <ian@iankelling.org>
Thu, 4 May 2017 23:42:08 +0000 (16:42 -0700)
.bashrc
brc

diff --git a/.bashrc b/.bashrc
index 7db792c3448da92d3e929ea4e04c76c513bd2637..d0c4b02f6bff6fbbbdc4c647a5ecbbea8812416a 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -53,6 +53,12 @@ if [[ $SSH_CONNECTION ]] \
        && [[ ! $BASH_LOGIN_SHELL == true ]]; then
     return
 else
-    source /etc/profile
-    source ~/brc
+    if [[ -r /etc/profile ]]; then
+        source /etc/profile
+    fi
+    _x=$(readlink -f $BASH_SOURCE)
+    _x=${_x%/*}/brc
+    if [[ -r $_x ]]; then
+        source $_x
+    fi
 fi
diff --git a/brc b/brc
index 69d54ad36ef79ac6b3e1ff2b23614b46620654b6..a71a7c763ec31cbbc6dbf51c8209ffbe097f88f9 100644 (file)
--- a/brc
+++ b/brc
@@ -300,21 +300,6 @@ b() {
     c -
 }
 
-bashrcpush () {
-    local startdir="$PWD"
-    cd ~
-    for x in "$@"; do
-        ssh $x mkdir -p bin/distro-functions/src
-        tar cz bin/semi-private bin/distro-functions/src | ssh $x tar xz
-    done
-    cd $(mktemp -d)
-    command cp /a/c/repos/bash/!(.git|..|.) ~/.gitconfig .
-    for x in "$@"; do
-        tar cz * | ssh $x tar xz
-    done
-    cd "$startdir"
-}
-
 bkrun() {
     # use -p from interactive shell
     btrbk-run -p "$@"
@@ -956,13 +941,16 @@ rlt() {
 }
 
 rlu() { # [OPTS] HOST PATH
-    # eg rlu -opts frodo /testpath
+    # eg. rlu -opts frodo /testpath
+    # relative paths will expanded with readlink -f.
     # useful for selectively sending dirs which have been synced with unison,
     # where the path is the same on both hosts.
     opts=("${@:1:$#-2}") #  1 to last -2
     path="${@:$#}" # last
     host="${@:$#-1:1}" # last -1
-    if [[ $path == .* ]]; then echo error: need absolut path; return 1; fi
+    if [[ $path == .* ]]; then
+        path=$(readlink -f $path)
+    fi
     # rync here uses checksum instead of time so we don't mess with
     # unison relying on time as much. g is for group, same reason
     # to keep up with unison.