# assume we want ssh commands to source this file if we are sourcing it,
# and we haven't specified otherwise already
[[ ! $BASH_LOGIN_SHELL ]] && export BASH_LOGIN_SHELL=true
+#BASH_LOGIN_SHELL=false # temporary override
# first conditions show that we are an ssh command without an interactive shell
if [[ $SSH_CONNECTION ]] \
# use extra globing features.
shopt -s extglob
# include .files when globbing, but ignore files name . and ..
-# setting this also sets dotglob
+# setting this also sets dotglob.
+# Note, this doesn't work in bash 4.4 anymore, for paths with
+# more than 1 directory, like a/b/.foo, since * is fixed to not match /
export GLOBIGNORE=*/.:*/..
# broken with bash_completion package. Saw a bug for this once. Don't anymore.
shopt -s checkwinsize
# attempt to save multiline single commands as single history entries.
shopt -s cmdhist
+# enable **
shopt -s globstar
###################
## include files ###
###################
-
for _x in /a/bin/distro-functions/src/* /a/bin/!(githtml)/*-function?(s); do
source "$_x"
done
unset _x
# so I can share my bashrc
-for x in /a/bin/bash_unpublished/!(.#*); do source $x; done
+for x in /a/bin/bash_unpublished/source-!(.#*); do source $x; done
source $(dirname $(readlink -f $BASH_SOURCE))/path_add-function
source /a/bin/log-quiet/logq-function
path_add /a/exe
#path_add $HOME/bin/bash-programs-by-ian/utils
+
###############
### aliases ###
###############
-
#####################
### functions ####
#####################
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 .
+ command cp /a/c/repos/bash/!(.git|..|.) ~/.gitconfig .
for x in "$@"; do
tar cz * | ssh $x tar xz
done
transmission() {
vc transmission-gtk&
i=0
- while ((i < 10)); do
+ while true; do
+ if ((i > 10)); then
+ echo "$0: error: vpn tun0 didn't show up"
+ return 1
+ fi
tun_ip=$(s ip netns exec vpn ip a show dev tun0 | sed -rn 's/^ *inet (10\.8\.\S+).*/\1/p')
[[ ! $tun_ip ]] || break
sleep 1
+ i=$((i + 1))
done
echo "$0: tun_ip=$tun_ip"
[[ $tun_ip ]] || { e "$0: error: no tun0 addr found"; return 1; }
-
-
###########################################
# stuff that makes sense to be at the end #
###########################################
if [[ ! $DISPLAY && $XDG_VTNR == 1 ]] && shopt -q login_shell && isarch; then
exec startx
fi
+
+
# ensure no bad programs appending to this file will have an affect
return 0