2020-11-03 12:07:49 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-02-11 18:29:28 -08:00
|
|
|
|
2023-02-23 10:03:47 -08:00
|
|
|
if [[ ! $(command -v arch) ]]; then
|
|
|
|
function arch() {
|
|
|
|
uname -m
|
|
|
|
}
|
|
|
|
fi
|
2021-02-11 18:29:28 -08:00
|
|
|
|
|
|
|
function function_list {
|
2020-11-06 14:24:10 -08:00
|
|
|
if [ $1 ]; then
|
2020-11-13 10:25:04 -08:00
|
|
|
# will list functions in passed file
|
2020-11-06 14:24:10 -08:00
|
|
|
local STR
|
|
|
|
local func
|
|
|
|
declare -a FUNCS
|
|
|
|
STR=$(grep '() {\|(){\|function' $1)
|
|
|
|
readarray -t LIST <<<"$STR"
|
|
|
|
for func in "${LIST[@]}"
|
|
|
|
do
|
|
|
|
if [[ ! $func =~ ^# ]]; then
|
2020-11-13 10:25:04 -08:00
|
|
|
func=${func#function }
|
2020-11-06 14:24:10 -08:00
|
|
|
func=${func%()?( ){}
|
|
|
|
[[ ! $func =~ ^_ ]] && FUNCS+=($func)
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "${FUNCS[@]}"
|
|
|
|
else
|
2020-11-27 09:59:16 -08:00
|
|
|
# will list all sourced/declared functions available
|
2020-11-03 12:07:49 -08:00
|
|
|
echo
|
|
|
|
echo -e "\033[1;4;32m""Functions:""\033[0;34m"
|
|
|
|
declare -F | grep -v "declare -f\s_" | awk {'print $3'}
|
|
|
|
echo
|
|
|
|
echo -e "\033[0m"
|
2020-11-06 14:24:10 -08:00
|
|
|
fi
|
2020-11-03 12:07:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function alias_list() {
|
|
|
|
echo
|
|
|
|
echo -e "\033[1;4;32m""Aliases:""\033[0;34m"
|
|
|
|
alias | awk {'print $2'} | awk -F= {'print $1'}
|
|
|
|
echo
|
|
|
|
echo -e "\033[0m"
|
|
|
|
}
|
|
|
|
|
2020-11-06 14:24:10 -08:00
|
|
|
get_shopt () {
|
|
|
|
echo $([ "$(shopt -p $1 | grep '\-s')" ] && echo on || echo off)
|
|
|
|
}
|
|
|
|
|
2020-11-03 12:07:49 -08:00
|
|
|
# edit files
|
2023-02-23 10:03:47 -08:00
|
|
|
# echo set the system editor using EDITOR environment variable
|
|
|
|
edit() { ${EDITOR:-nano} $@; }
|
|
|
|
gedit() { ${GEDITOR:-xed} $@; }
|
2024-02-16 23:49:08 -08:00
|
|
|
|
|
|
|
|
2024-03-01 15:01:47 -08:00
|
|
|
unlocku () ( faillock --user $1 --reset )
|
|
|
|
|
2024-02-16 23:49:08 -08:00
|
|
|
rsynchg() { rsync --help | grep "\-$1"; }
|