From a41e477d8fbc37a08928879cb2c4d658def8d749 Mon Sep 17 00:00:00 2001 From: David Kebler Date: Fri, 19 Apr 2024 13:53:10 -0700 Subject: [PATCH] added couple basic aliases fixed copy arguments bug added GIT url file to load after done --- load/alias/00-basic | 7 +++++-- modules/uci-shell-install.lib | 4 ++++ modules/utility/copy.lib | 29 ++++++++++++++--------------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/load/alias/00-basic b/load/alias/00-basic index feba75a..78bc22b 100644 --- a/load/alias/00-basic +++ b/load/alias/00-basic @@ -65,9 +65,12 @@ alias umountf="sudo umount -l" alias loginust="loginctl show-user $USER" - # alias to add for live user if [ -v PS1 ]; then alias dfind="_find -t d -d 0 -n " alias sdfind="_find -s -t d -d 0 -n " -fi \ No newline at end of file +fi + +alias portl="ss -tunl | grep" + +alias ipg="ip addr show | grep -A1 " \ No newline at end of file diff --git a/modules/uci-shell-install.lib b/modules/uci-shell-install.lib index d87e1a4..b3a3b19 100644 --- a/modules/uci-shell-install.lib +++ b/modules/uci-shell-install.lib @@ -19,6 +19,7 @@ # chmod -R +r $rpath # } + # must! be run as sudo install_shell_base () { if [[ $1 == "-f" ]];then @@ -53,6 +54,9 @@ install_shell_base () { chmod -R +r /shell /bin/bash /shell/base/install/install.sh ${1:-1000} + + # TODO now add BASH_SHELL_GIT_URL=$BASH_SHELL_GIT_URL to load directory + echo "export BASH_SHELL_GIT_URL=$BASH_SHELL_GIT_URL" > $BASH_SHELL_BASE/load/ucishellgiturl } # # if script was executed then call the function diff --git a/modules/utility/copy.lib b/modules/utility/copy.lib index b0d6db3..8f91a26 100644 --- a/modules/utility/copy.lib +++ b/modules/utility/copy.lib @@ -12,7 +12,7 @@ copy () { local SHOST; local DHOST; local sshargs; local args local SRC; local DEST; local mirror; local quiet; local Mirror local SPATH; local DPATH; local exec; local list; local verbose - local usesudo;local cmd;local noconfirm;local insert + local usesudo;local cmd;local noconfirm;local insert; local sargs args=() @@ -172,20 +172,19 @@ EOF [[ ! $SHOST ]] && SPATH=$(realpath $SPATH) [[ ! $DHOST ]] && DPATH=$(realpath $DPATH) - # parse ssh arguments from the rest - debug $( ( IFS=$','; echo all arguments: "$*" ) ) - for ((d=1; d<$#; ++d)); do - [[ ${!d} == "---" ]] && break - done - if [[ $d -lt $# ]]; then # if there are extra ssh arguments - debug found --- at $d - sshargs=("${@:$d+1:$#}") - debug $( ( IFS=$','; echo "ssh arguments: ${sshargs[*]}" ) ) - args+=("${@:1:$d-1}") - debug $( ( IFS=$','; echo remaining arguments to parse: "$*" ) ) - else - args+=("${@:1}") - fi + debug $( ( IFS=$','; echo all arguments: "$*" ) ) + for ((d=1; d<$#+1; ++d)); do + # echo in loop $d, ${!d} + [[ ${!d} == "--" ]] && sargs=true && break + done + if [[ $sargs ]]; then # if there are extra ssh arguments + sshargs=("${@:$d+1:$#}") + debug $( ( IFS=$','; echo "ssh arguments: ${sshargs[*]}" ) ) + args=("${@:1:$d-1}") + debug $( ( IFS=$','; echo remaining arguments to parse: "$*" ) ) + else + args=("${@:1}") + fi [[ $DHOST || $SHOST ]] && args+=( "$(remove_end_spaces "-e '$(ssh -l "${sshargs[*]}")'")")