Files
linux-workspace/rc/functions.sh
2021-11-28 14:57:07 +01:00

35 lines
464 B
Bash

# $LWS/rc/functions.sh
function jql() {
jq -C . "$@" | less -r
}
function ffile() {
local filename="$1"
shift
file $(type -p "$filename") $@
}
# print time in seconds with nanoseconds precission
function utime() {
date '+%s.%N'
}
function in_path() {
[[ "$PATH" =~ (^|:)"${1}"(:|$) ]]
}
function append_path() {
if ! in_path "$1"; then
PATH="$PATH:$1"
fi
}
function prepend_path() {
if ! in_path "$1"; then
PATH="$1:$PATH"
fi
}