#!/bin/bash BTPLDIR=$(dirname $(module_find btpl)) export BTPLDIR btpl_fetch () { # /opt/python/apps/bin/lastversion --assets --output /shell/base/modules/scripting/btpl.lib download bash-tpl wget -O "$BTPLDIR"/btpl.run https://raw.githubusercontent.com/TekWizely/bash-tpl/main/bash-tpl chmod +x "$BTPLDIR"/btpl.run # sed -i 's/\bmain\b/btpl/g' /shell/base/modules/scripting/btpl.lib } btpl () { local dir if [[ $1 == "-d" ]]; then shift; dir=$1; shift; pushd $dir 1>/dev/null || return; fi [[ ! $BTPLDIR ]] && echo unable to establish Bash Template directory && return 2 [[ ! -f $BTPLDIR/btpl.run ]] && btpl_fetch for btpl in *.btpl; do [[ -f "$btpl" ]] || break echo processing $btpl ... # echo sudo $BTPLDIR/btpl.run --output-file $(basename $btpl .btpl)$([[ $1 ]] && echo .$1) $btpl $BTPLDIR/btpl.run $btpl source <($BTPLDIR/btpl.run $btpl) | sudo tee $(basename $btpl .btpl)$([[ $1 ]] && echo .$1) done if [[ $dir ]]; then popd 1>/dev/null || return; fi } sDNS () { output=$(basename $1 .dns) cp $1 $output cat $output for host in $(sed -e 's/ /\n/g' $1 | sed -n 's/[Dd][Nn][Ss]://p'); do echo $host: $(dip $host) sed -i 's/[Dd][Nn][Ss]:'$host'/'$(dip $host)'/g' $output cat $output done }