Skip to content

Commit 8d19c87

Browse files
Oliver Weilermarc0der
authored andcommitted
Declare line_without_comments as local and readonly
1 parent f2f56f5 commit 8d19c87

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/main/bash/sdkman-auto-env.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright 2017 Marco Vermeulen
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
function cd() {
20+
builtin cd "$@"
21+
22+
[[ -f ".sdkmanrc" ]] && sdk env
23+
}

src/main/bash/sdkman-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function __sdkman_is_blank_line() {
7676
}
7777

7878
function __sdkman_normalise() {
79-
local line_without_comments="${1/\#*/}"
79+
local -r line_without_comments="${1/\#*/}"
8080

8181
echo "${line_without_comments//[[:space:]]/}"
8282
}

0 commit comments

Comments
 (0)