initial commit
This commit is contained in:
parent
b6268ab155
commit
b09e7d2560
43
bsf.sh
Normal file
43
bsf.sh
Normal file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
##### bash framework
|
||||
# some useful bash functions to make things easier
|
||||
# 25.3.18 mrz
|
||||
# 10.7.18 add style function
|
||||
|
||||
## use printf for safety purposes
|
||||
# http://www.etalabs.net/sh_tricks.html
|
||||
# @param string what to say
|
||||
say () { printf %s\\n "$*" ; }
|
||||
sayn () { printf %s "$*" ; }
|
||||
|
||||
## check if user is root
|
||||
root () { [[ "$EUID" -eq 0 ]] ; }
|
||||
|
||||
## colors
|
||||
# use ANSI escape codes
|
||||
normal () { printf '\033[0m' ; }
|
||||
red () { printf '\033[0;31m' ; }
|
||||
green () { printf '\033[0;32m' ; }
|
||||
black () { printf '\033[0;30m' ; }
|
||||
brown () { printf '\033[0;33m' ; }
|
||||
orange () { printf '\033[0;33m' ; }
|
||||
blue () { printf '\033[0;34m' ; }
|
||||
purple () { printf '\033[0;35m' ; }
|
||||
cyan () { printf '\033[0;36m' ; }
|
||||
gray () { printf '\033[0;37m' ; }
|
||||
grey () { printf '\033[1;30m' ; }
|
||||
lred () { printf '\033[1;31m' ; }
|
||||
lgreen () { printf '\033[1;32m' ; }
|
||||
yellow () { printf '\033[1;33m' ; }
|
||||
lblue () { printf '\033[1;34m' ; }
|
||||
lpurple (){ printf '\033[1;35m' ; }
|
||||
lcyan () { printf '\033[1;36m' ; }
|
||||
white () { printf '\033[1;37m' ; }
|
||||
|
||||
# quick styler, usage "style *color*"
|
||||
style() {
|
||||
[[ "$1" == "" ]] && orange || $1
|
||||
sayn " :::"
|
||||
normal
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user