#!/bin/bash # Copyright (C) 2019 Ian Kelling # SPDX-License-Identifier: AGPL-3.0-or-later # to debug #set -x # redirect output to log file. this doesn't work. todo figure out why #exec 1>>/a/tmp/bashlog #exec 2>>/a/tmp/bashlog # see comments in brc2 sl() function for background. if [[ $SSH_CONNECTION ]] \ && [[ $BRC != t ]]; then return 0 else # the distinction between login and non-login shells is lame, # get rid of it. note ssh shells normally its login if a command is passed if ! shopt -q login_shell; then if [[ -r /etc/profile ]]; then source /etc/profile fi # note, this is not exactly the same as a login shell, because that # reads ~/.bash_profile or alternative, which usually just sources # this file, and we don't want to do that and cause an infinite # loop. fi _tmp=$(readlink -f ${BASH_SOURCE[0]}) _tmp=${_tmp%/*} _tmp2=$_tmp/brc if [[ -s $_tmp2 ]]; then # shellcheck source=./brc source $_tmp2 fi # brc2 is for things i dont necessarily want on every system _tmp2=$_tmp/brc2 if [[ -s $_tmp2 ]]; then # shellcheck source=./brc2 source $_tmp2 else # This check is for when running the sl() command, # and the remote host got its type misidentified. _tmp2=$_tmp/../brc2 if [[ -s $_tmp2 ]]; then # shellcheck source=./brc2 source $_tmp2 fi fi fi # ensure no bad programs appending to this file will have an affect return 0