This repository was archived by the owner on Apr 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ The _"Better BASH Library"_: A set of functions to assist with creating well-wri
7
7
Add this to the top of your BASH script:
8
8
9
9
``` bash
10
- source <( wget -qO- https://raw.githubusercontent.com/MrDrMcCoy/bblib/1.1.2 /bblib.bash)
10
+ source <( wget -qO- https://raw.githubusercontent.com/MrDrMcCoy/bblib/1.1.3 /bblib.bash)
11
11
```
12
12
13
13
Alternately, clone this repo locally and use ` source ` with the full path to ` bblib.bash ` .
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ log () {
119
119
# Send message to logger
120
120
if [ " ${NUMERIC_SEVERITY} " -le " ${NUMERIC_LOGLEVEL} " ] ; then
121
121
tr ' \n' ' ' <<< " ${LOGMSG}" | logger -s -p " user.${NUMERIC_SEVERITY} " -t " ${LOGTAG} " | & \
122
- if [ -n " ${LOGFILE} " ] ; then
122
+ if [ -n " ${LOGFILE:- } " ] ; then
123
123
tee -a " ${LOGFILE} " | pprint ${LOGCOLORS[$NUMERIC_SEVERITY]}
124
124
elif [ ! -t 0 ]; then
125
125
pprint ${LOGCOLORS[$NUMERIC_SEVERITY]} < /dev/stdin
@@ -182,13 +182,13 @@ requireuser () {
182
182
# Checks to see if current user matches $REQUIREUSER and exits if not.
183
183
# REQUIREUSER can be set as a variable or passed in as an argument.
184
184
# Usage: requireuser [user]
185
- local REQUIREUSER=" ${1:- $REQUIREUSER } "
186
- if [ -z " $REQUIREUSER " ] ; then
185
+ local REQUIREUSER=" ${1:- ${ REQUIREUSER:- } } "
186
+ if [ -z " ${ REQUIREUSER:- } " ] ; then
187
187
quit " ERROR" " requireuser was called, but \$ REQUIREUSER is not set"
188
- elif [ " $REQUIREUSER " != " $USER " ] ; then
188
+ elif [ " $REQUIREUSER " != " $EUID " ] ; then
189
189
quit " ERROR" " Only $REQUIREUSER is allowed to run this script"
190
190
else
191
- log " DEBUG" " User '$USER ' matches '$REQUIREUSER ' and is allowed to run this script"
191
+ log " DEBUG" " User '$EUID ' matches '$REQUIREUSER ' and is allowed to run this script"
192
192
fi
193
193
}
194
194
You can’t perform that action at this time.
0 commit comments