Skip to content

Commit 97a76cd

Browse files
Oliver WeilerMarco Vermeulen
authored andcommitted
Replace $(cat file) invocations with $(< file) for better performance
1 parent dae40c3 commit 97a76cd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/bash/sdkman-availability.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ function __sdkman_update_broadcast() {
7575
broadcast_old_id=""
7676

7777
if [[ -f "$broadcast_id_file" ]]; then
78-
broadcast_old_id=$(cat "$broadcast_id_file")
78+
broadcast_old_id=$(< "$broadcast_id_file")
7979
fi
8080

8181
if [[ -f "$broadcast_text_file" ]]; then
82-
BROADCAST_OLD_TEXT=$(cat "$broadcast_text_file")
82+
BROADCAST_OLD_TEXT=$(< "$broadcast_text_file")
8383
fi
8484

8585
if [[ "$SDKMAN_AVAILABLE" == "true" && "$broadcast_live_id" != "$broadcast_old_id" && "$COMMAND" != "selfupdate" && "$COMMAND" != "flush" ]]; then

src/main/bash/sdkman-cache.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
function ___sdkman_check_candidates_cache() {
2020
local candidates_cache="$1"
21-
if [[ -f "$candidates_cache" && -n "$(cat "$candidates_cache")" && -n "$(find "$candidates_cache" -mmin +$((24 * 60 * 30)))" ]]; then
21+
if [[ -f "$candidates_cache" && -n "$(< "$candidates_cache")" && -n "$(find "$candidates_cache" -mmin +$((24 * 60 * 30)))" ]]; then
2222
__sdkman_echo_yellow 'We periodically need to update the local cache. Please run:'
2323
echo ''
2424
__sdkman_echo_no_colour ' $ sdk update'
2525
echo ''
2626
return 0
27-
elif [[ -f "$candidates_cache" && -z "$(cat "$candidates_cache")" ]]; then
27+
elif [[ -f "$candidates_cache" && -z "$(< "$candidates_cache")" ]]; then
2828
__sdkman_echo_red 'WARNING: Cache is corrupt. SDKMAN cannot be used until updated.'
2929
echo ''
3030
__sdkman_echo_no_colour ' $ sdk update'

0 commit comments

Comments
 (0)