-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcc_path.sh
executable file
·39 lines (31 loc) · 981 Bytes
/
cc_path.sh
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
c_path_search() {
##############################
# FUNCTION PARAMETERS
##############################
local -r KEYWORD="$1" # keyword to search inside $PATH
##############################
##############################
##############################
# IGNORE CASE = -i
# tr ':' '\n' = replaces : character to new-line
___execute_with_eval "printf \"%s\" \""'$PATH'"\" | tr ':' '\n' | grep \"$KEYWORD\" -i | color_line"
}
c_path_add() {
##############################
# FUNCTION PARAMETERS
##############################
local -r NEW_DIR="$1"
##############################
##############################
##############################
___is_empty_string "$NEW_DIR" && {
___print_screen "$NEW_DIR is empty."
return
}
___string_contains "$PATH" "$NEW_DIR" && {
___print_screen "$NEW_DIR already exist."
return
}
PATH="$NEW_DIR:$PATH"
___print_screen "Path added. New PATH: $PATH"
}