clean up basic loading

master
David Kebler 2024-02-12 13:11:40 -08:00
parent 39d6cc755e
commit d77c046c0b
3 changed files with 24 additions and 34 deletions

View File

@ -42,45 +42,11 @@ function alias_list() {
echo -e "\033[0m"
}
rsynchc() { rsync --help | grep "\-$1"; }
alias rsynch="rsynchc"
get_shopt () {
echo $([ "$(shopt -p $1 | grep '\-s')" ] && echo on || echo off)
}
change-ext() {
local depth
local d
d=${3:-0}
let d+=1
[ $d -lt 1 ] && depth="" || depth=" -maxdepth $d "
find . $depth -name '*.'$1 -exec rename -n 's/\.'$1'/.'$2'/' \{} \;
read -p "do REALLY want to change the extensions? " -n 1 -r
echo
[[ ! $REPLY =~ ^[Yy]$ ]] && return 1
find . $depth -name '*.'$1 -exec rename 's/\.'$1'/.'$2'/' \{} \;
}
alias chext=change-ext
# find in any file
fif() {
grep -rnswl $1 -e $2 | more
}
# edit files
# echo set the system editor using EDITOR environment variable
edit() { ${EDITOR:-nano} $@; }
gedit() { ${GEDITOR:-xed} $@; }
add-repo-key () {
gpg --keyserver keyserver.ubuntu.com --recv-key $1
gpg -a --export $1 | sudo apt-key add -
}
alias ssudo="ssudo "

View File

@ -12,6 +12,9 @@ isDir() {
fi
}
rsynchc() { rsync --help | grep "\-$1"; }
alias rsynch="rsynchc"
function dir_copy () {
[[ ! $(command -v rsync) ]] && { echo rsync must be installed to use this function; return 5; }

View File

@ -14,6 +14,11 @@ isFile() {
fi
}
# find in any file
fif() {
grep -rnswl $1 -e $2 | more
}
build_file () {
# local file
# echo build file $1 $2
@ -272,3 +277,19 @@ if [ -v PS1 ]; then
alias dfind="_find -t d -d 0 -n "
alias sdfind="_find -s -t d -d 0 -n "
fi
change-ext() {
local depth
local d
d=${3:-0}
let d+=1
[ $d -lt 1 ] && depth="" || depth=" -maxdepth $d "
find . $depth -name '*.'$1 -exec rename -n 's/\.'$1'/.'$2'/' \{} \;
read -p "do REALLY want to change the extensions? " -n 1 -r
echo
[[ ! $REPLY =~ ^[Yy]$ ]] && return 1
find . $depth -name '*.'$1 -exec rename 's/\.'$1'/.'$2'/' \{} \;
}
alias chext=change-ext