Skip to content

Commit e2c679c

Browse files
committed
use pure bash for uppercasing strings. fixes #36
1 parent aad7446 commit e2c679c

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [unreleased]
8+
9+
### Changed
10+
* Use pure Bash for uppercasing strings ([#36](https://github.com/ehough/docker-nfs-server/issues/36))
11+
712
## [2.2.1] - 2019-03-15
813

914
### Fixed

Diff for: entrypoint.sh

+4-13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# https://hub.docker.com/r/erichough/nfs-server
66
# https://github.com/ehough/docker-nfs-server
77
#
8-
# Copyright (C) 2017-2019 Eric D. Hough
8+
# Copyright (C) 2017-2020 Eric D. Hough
99
#
1010
# This program is free software: you can redistribute it and/or modify
1111
# it under the terms of the GNU General Public License as published by
@@ -75,16 +75,6 @@ readonly STATE_NFS_VERSION='nfs_version'
7575
declare -A state
7676

7777

78-
######################################################################################
79-
### string utils
80-
######################################################################################
81-
82-
toupper() {
83-
84-
echo "$1" | awk '{ print toupper($0) }'
85-
}
86-
87-
8878
######################################################################################
8979
### logging
9080
######################################################################################
@@ -110,7 +100,7 @@ log_header() {
110100

111101
echo "
112102
==================================================================
113-
$(toupper "$1")
103+
${1^^}
114104
=================================================================="
115105
}
116106

@@ -341,7 +331,8 @@ assert_port() {
341331
init_state_logging() {
342332

343333
# if the user didn't request a specific log level, the default is INFO
344-
local -r normalized_log_level=$(toupper "${!ENV_VAR_NFS_LOG_LEVEL:-$LOG_LEVEL_INFO}")
334+
local incoming_log_level="${!ENV_VAR_NFS_LOG_LEVEL:-$LOG_LEVEL_INFO}"
335+
local -r normalized_log_level="${incoming_log_level^^}"
345336

346337
if ! echo "$normalized_log_level" | grep -Eq 'DEBUG|INFO'; then
347338
bail "the only acceptable values for $ENV_VAR_NFS_LOG_LEVEL are: DEBUG, INFO"

0 commit comments

Comments
 (0)