-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path@includes.sh
More file actions
executable file
·57 lines (49 loc) · 1006 Bytes
/
@includes.sh
File metadata and controls
executable file
·57 lines (49 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# define colors: https://unix.stackexchange.com/a/269085
red=`tput setaf 1`
green=`tput setaf 2`
orange=`tput setaf 3`
reset=`tput sgr0`
# example: log 'Hello World'
log() {
echo '['$(date +'%a %Y-%m-%d %H:%M:%S %z')']' $1
}
# example: result=$(extension $filename)
extension() {
local filename=$1
local extension="${filename##*.}"
echo "$extension"
}
# example: echoNewline
echoNewline() {
printf "\n"
}
# example: echoDivider
echoDivider() {
echo '###################################################'
}
# example: echoError 'Kaput'
# -e to enable \n newlines
echoError() {
echoNewline
echoDivider
echo -e "# ${red}[ERROR]${reset}: $1"
echoDivider
echoNewline
}
# example: echoInfo 'Informations'
echoInfo() {
# echoNewline
echoDivider
echo -e "# ${orange}[INFO]${reset}: $1"
echoDivider
# echoNewline
}
# example: echoSuccess 'Nice!'
echoSuccess() {
echoNewline
echoDivider
echo -e "# ${green}[SUCCESS]${reset}: $1"
echoDivider
echoNewline
}