new functions

main
CrimsonTome 2022-02-01 16:09:25 +00:00
parent 7fe8aea211
commit 20ba77a4de
1 changed files with 62 additions and 37 deletions

View File

@ -5,10 +5,11 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias ls='ls -Al --color=auto'
#sets the prompt to the userame@hostname with the full working directory, starts a newline for the command to be on
PS1="\e[35m\u@\h~$ \n\w > \e[m"
PS1="\u@\h~$
\w"$(tput setaf 2)" "$(tput blink)" > "$(tput sgr0)" "
########
#ALCI
@ -16,40 +17,9 @@ PS1="\e[35m\u@\h~$ \n\w > \e[m"
alias evb='sudo systemctl enable --now vboxservice.service'
#######
##-----------------------------------------------------
## synth-shell-greeter.sh
if [ -f /home/ctome/.config/synth-shell/synth-shell-greeter.sh ] && [ -n "$( echo $- | grep i )" ]; then
source /home/ctome/.config/synth-shell/synth-shell-greeter.sh
fi
##-----------------------------------------------------
## synth-shell-prompt.sh
if [ -f /home/ctome/.config/synth-shell/synth-shell-prompt.sh ] && [ -n "$( echo $- | grep i )" ]; then
source /home/ctome/.config/synth-shell/synth-shell-prompt.sh
fi
##-----------------------------------------------------
## better-ls
if [ -f /home/ctome/.config/synth-shell/better-ls.sh ] && [ -n "$( echo $- | grep i )" ]; then
source /home/ctome/.config/synth-shell/better-ls.sh
fi
##-----------------------------------------------------
## alias
if [ -f /home/ctome/.config/synth-shell/alias.sh ] && [ -n "$( echo $- | grep i )" ]; then
source /home/ctome/.config/synth-shell/alias.sh
fi
##-----------------------------------------------------
## better-history
if [ -f /home/ctome/.config/synth-shell/better-history.sh ] && [ -n "$( echo $- | grep i )" ]; then
source /home/ctome/.config/synth-shell/better-history.sh
fi
#user aliases
#some apapted/taken from sbrl's bash aliases
#some adapted from sbrl's bash aliases
alias pi='sudo pacman -S'
alias pu='sudo pacman -Syu'
alias gc='git clone'
@ -58,11 +28,9 @@ alias gph='git push'
alias gl='git log'
alias gac='git commit -am'
alias gs='git status'
alias his='history > history.log && cat history.log'
alias untar='tar -zxvf'
alias ipe='curl ipinfo.io/ip'
alias c='clear'
alias lines='wc -l'
alias words='wc -w'
alias yt='youtube-dl'
alias mp3='youtube-dl -x --audio-format mp3'
@ -77,6 +45,10 @@ alias mv='mv -vi'
alias upstats='echo "Up since:" && uptime -s && uptime -p'
alias sshserver='ssh root@192.168.100.2'
alias restartwifi='sudo systemctl restart iwd.service'
#end of manual aliases
#user functions
up () {
local d=""
local limit="$1"
@ -95,4 +67,57 @@ up () {
echo "Couldn't go up $limit dirs.";
fi
}
# end of manual aliases
#### from https://github.com/dylanaraps/pure-bash-bible/blob/master/README.md
bkr() {
(nohup "$@" &>/dev/null &)
}
bkr ./some_script.sh # some_script.sh is now running in the background
trim_all() {
# Usage: trim_all " example string "
set -f
set -- $*
printf '%s\n' "$*"
set +f
}
split() {
# Usage: split "string" "delimiter"
IFS=$'\n' read -d "" -ra arr <<< "${1//$2/$'\n'}"
printf '%s\n' "${arr[@]}"
}
lower() {
# Usage: lower "string"
printf '%s\n' "${1,,}"
}
upper() {
# Usage: upper "string"
printf '%s\n' "${1^^}"
}
reverse_case() {
# Usage: reverse_case "string"
printf '%s\n' "${1~~}"
}
strip_all() {
# Usage: strip_all "string" "pattern"
printf '%s\n' "${1//$2}"
}
lines() {
# Usage: lines "file"
mapfile -tn 0 lines < "$1"
printf '%s\n' "${#lines[@]}"
}
# end of user functions
#startup commands
PF_INFO="ascii title os host kernel uptime pkgs memory shell editor wm de" pfetch|lolcat