new functions
parent
7fe8aea211
commit
20ba77a4de
99
arch/.bashrc
99
arch/.bashrc
|
@ -5,10 +5,11 @@
|
||||||
# If not running interactively, don't do anything
|
# If not running interactively, don't do anything
|
||||||
[[ $- != *i* ]] && return
|
[[ $- != *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
|
#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="[35m\u@\h~$
|
||||||
|
\w"$(tput setaf 2)" "$(tput blink)" > "$(tput sgr0)" [m"
|
||||||
|
|
||||||
########
|
########
|
||||||
#ALCI
|
#ALCI
|
||||||
|
@ -16,40 +17,9 @@ PS1="\e[35m\u@\h~$ \n\w > \e[m"
|
||||||
alias evb='sudo systemctl enable --now vboxservice.service'
|
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
|
#user aliases
|
||||||
#some apapted/taken from sbrl's bash aliases
|
#some adapted from sbrl's bash aliases
|
||||||
alias pi='sudo pacman -S'
|
alias pi='sudo pacman -S'
|
||||||
alias pu='sudo pacman -Syu'
|
alias pu='sudo pacman -Syu'
|
||||||
alias gc='git clone'
|
alias gc='git clone'
|
||||||
|
@ -58,11 +28,9 @@ alias gph='git push'
|
||||||
alias gl='git log'
|
alias gl='git log'
|
||||||
alias gac='git commit -am'
|
alias gac='git commit -am'
|
||||||
alias gs='git status'
|
alias gs='git status'
|
||||||
alias his='history > history.log && cat history.log'
|
|
||||||
alias untar='tar -zxvf'
|
alias untar='tar -zxvf'
|
||||||
alias ipe='curl ipinfo.io/ip'
|
alias ipe='curl ipinfo.io/ip'
|
||||||
alias c='clear'
|
alias c='clear'
|
||||||
alias lines='wc -l'
|
|
||||||
alias words='wc -w'
|
alias words='wc -w'
|
||||||
alias yt='youtube-dl'
|
alias yt='youtube-dl'
|
||||||
alias mp3='youtube-dl -x --audio-format mp3'
|
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 upstats='echo "Up since:" && uptime -s && uptime -p'
|
||||||
alias sshserver='ssh root@192.168.100.2'
|
alias sshserver='ssh root@192.168.100.2'
|
||||||
alias restartwifi='sudo systemctl restart iwd.service'
|
alias restartwifi='sudo systemctl restart iwd.service'
|
||||||
|
#end of manual aliases
|
||||||
|
|
||||||
|
|
||||||
|
#user functions
|
||||||
up () {
|
up () {
|
||||||
local d=""
|
local d=""
|
||||||
local limit="$1"
|
local limit="$1"
|
||||||
|
@ -95,4 +67,57 @@ up () {
|
||||||
echo "Couldn't go up $limit dirs.";
|
echo "Couldn't go up $limit dirs.";
|
||||||
fi
|
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue