#
#################################################################################
case "$BASH_SOURCE" in */*) path="${BASH_SOURCE%/*}";; *) path='.' ;; esac
-. "$path/bashrc.function"
+[ -e "$path/bashrc.function" ] && . "$path/bashrc.function"
NB_ROOT=$(realpath ${path}/..)
unset path
#
#################################################################################
shell_functions() {
- set | perl -ne '/^([\w_-]+) \(\)\s*$/ and print "$1\n"'
+ set | perl -ne '/^([a-z][\w_-]+) \(\)\s*$/ and print "$1\n"'
+}
+
+shell_slogin() {
+ declare server; server="$1"; shift
+ declare tmp; tmp="/tmp/$FUNCNAME.$USER"
+ (
+ alias
+ type $(shell_functions) | grep -v 'is a function$'
+ cat $NB_ROOT/etc/bashrc
+ ) | ssh "$server" "cat > $tmp || rm -vf $tmp" || return
+
+ declare args
+ if [ -z "$@" ]; then
+ slogin -qt "$server" "bash --rcfile $tmp && rm -f $tmp"
+ else
+ slogin -qt "$server" "bash && rm -f $tmp" <<< ". $tmp; $@"
+ fi
}
ips() {