Add helper functions
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# $LWS/rc/functions.sh
|
# Linux Workspace Functions
|
||||||
|
|
||||||
function xlog() {
|
function xlog() {
|
||||||
if true_false "$LWS_DEBUG"; then
|
if true_false "$LWS_DEBUG"; then
|
||||||
@@ -21,6 +21,18 @@ function utime() {
|
|||||||
date '+%s.%N'
|
date '+%s.%N'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sqltime() {
|
||||||
|
date '+%Y-%m-%d %H:%M:%S'
|
||||||
|
}
|
||||||
|
|
||||||
|
function lines() {
|
||||||
|
tr ":" "\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
function path() {
|
||||||
|
echo "$PATH" | lines
|
||||||
|
}
|
||||||
|
|
||||||
function in_path() {
|
function in_path() {
|
||||||
[[ "$PATH" =~ (^|:)"${1}"(:|$) ]]
|
[[ "$PATH" =~ (^|:)"${1}"(:|$) ]]
|
||||||
}
|
}
|
||||||
@@ -49,6 +61,10 @@ function prepend_path_try() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove_path() {
|
||||||
|
PATH=$(path | grep -v "$1" | tr "\n" ":")
|
||||||
|
}
|
||||||
|
|
||||||
function uniq_path() {
|
function uniq_path() {
|
||||||
echo "$PATH" | tr ":" "\n" | awk '!seen[$0]++' | tr "\n" ":" | sed -r 's/:+/:/g' | sed -r 's/^:|:$//g'
|
echo "$PATH" | tr ":" "\n" | awk '!seen[$0]++' | tr "\n" ":" | sed -r 's/:+/:/g' | sed -r 's/^:|:$//g'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,14 +34,11 @@ alias kl=kubectl
|
|||||||
alias kld='kubectl describe'
|
alias kld='kubectl describe'
|
||||||
alias klg='kubectl get'
|
alias klg='kubectl get'
|
||||||
|
|
||||||
alias lines='tr ":" "\n"'
|
|
||||||
|
|
||||||
# Extra space!
|
# Extra space!
|
||||||
alias sudo='sudo '
|
alias sudo='sudo '
|
||||||
|
|
||||||
alias ncdu='ncdu --color dark'
|
alias ncdu='ncdu --color dark'
|
||||||
|
|
||||||
alias path='echo -e ${PATH//:/\\n}'
|
|
||||||
alias now='date "+%T"'
|
alias now='date "+%T"'
|
||||||
alias sqldate='date "+%Y-%m-%d %H:%M:%S"'
|
alias sqldate='date "+%Y-%m-%d %H:%M:%S"'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Load user locals bashrc
|
# Load user locals bashrc
|
||||||
|
|
||||||
source_directory_sh "$LWS/rc.local"
|
source_directory_sh "$LWS/rc.local"
|
||||||
|
# user operations are in the end to have change to change everyting/anything
|
||||||
source_directory_sh "$HOME/.bashrc.d"
|
source_directory_sh "$HOME/.bashrc.d"
|
||||||
Reference in New Issue
Block a user