File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ # -----------------------------------------------------------------------
2+ #
3+ # Basescript function
4+ #
5+ # The basescript functions were designed to work as abstract function,
6+ # so it could be used in many different contexts executing specific job
7+ # always remembering Unix concept DOTADIW - "Do One Thing And Do It Well"
8+ #
9+ # Developed by
10+ # Evert Ramos <evert.ramos@gmail.com>
11+ #
12+ # Copyright Evert Ramos
13+ #
14+ # -----------------------------------------------------------------------
15+ #
16+ # Be careful when editing this file, it is part of a bigger script!
17+ #
18+ # Basescript - https://github.com/evertramos/basescript
19+ #
20+ # -----------------------------------------------------------------------
21+
22+ # -----------------------------------------------------------------------
23+ # This function has one main objective:
24+ # 1. Check if a command is installed
25+ #
26+ # You must/might inform the parameters below:
27+ # 1. Command name
28+ #
29+ # -----------------------------------------------------------------------
30+
31+ system_check_command_installed ()
32+ {
33+ local LOCAL_COMMAND
34+
35+ LOCAL_COMMAND=${1:- null}
36+
37+ [[ $LOCAL_COMMAND == " " ]] && echoerror " You must inform the COMMAND NAME to the function: '${FUNCNAME[0]} '"
38+
39+ [[ " $DEBUG " == true ]] && echo " Checking if command '$LOCAL_COMMAND ' is installed."
40+
41+ if [[ ! -x " $( command -v " $LOCAL_COMMAND " ) " ]]; then
42+ COMMAND_IS_INSTALLED=true
43+ else
44+ COMMAND_IS_INSTALLED=false
45+ fi
46+ }
47+
You can’t perform that action at this time.
0 commit comments