shell-base/function/00-basic

39 lines
768 B
Plaintext
Raw Normal View History

#!/bin/bash
# 00 will get loaded first
##-- functions which may be used by any of the alias file --#
function function_list() {
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"
}
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"
}
rsynchc() { rsync --help | grep "\-$1"; }
alias rsynch="rsynchc"
change-ext() {
shopt -s globstar
rename -n 's/.'+$1+'/.'+$2+'/' **
}
alias chext=change-ext
# find in any file
fif() {
grep -rnswl $1 -e $2 | more
}
# edit files
# set the system editor using EDITOR environment variable
editor() { ${EDITOR} $1; }