Add helper functions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $LWS/rc/functions.sh
|
||||
# Linux Workspace Functions
|
||||
|
||||
function xlog() {
|
||||
if true_false "$LWS_DEBUG"; then
|
||||
@@ -21,6 +21,18 @@ function utime() {
|
||||
date '+%s.%N'
|
||||
}
|
||||
|
||||
function sqltime() {
|
||||
date '+%Y-%m-%d %H:%M:%S'
|
||||
}
|
||||
|
||||
function lines() {
|
||||
tr ":" "\n"
|
||||
}
|
||||
|
||||
function path() {
|
||||
echo "$PATH" | lines
|
||||
}
|
||||
|
||||
function in_path() {
|
||||
[[ "$PATH" =~ (^|:)"${1}"(:|$) ]]
|
||||
}
|
||||
@@ -49,6 +61,10 @@ function prepend_path_try() {
|
||||
fi
|
||||
}
|
||||
|
||||
function remove_path() {
|
||||
PATH=$(path | grep -v "$1" | tr "\n" ":")
|
||||
}
|
||||
|
||||
function uniq_path() {
|
||||
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 klg='kubectl get'
|
||||
|
||||
alias lines='tr ":" "\n"'
|
||||
|
||||
# Extra space!
|
||||
alias sudo='sudo '
|
||||
|
||||
alias ncdu='ncdu --color dark'
|
||||
|
||||
alias path='echo -e ${PATH//:/\\n}'
|
||||
alias now='date "+%T"'
|
||||
alias sqldate='date "+%Y-%m-%d %H:%M:%S"'
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Load user locals bashrc
|
||||
|
||||
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"
|
||||
Reference in New Issue
Block a user