Skip to content
This repository was archived by the owner on Mar 1, 2025. It is now read-only.

Commit e52ebcf

Browse files
committed
fix: [#294] add bash version requirement.
1 parent ea34a92 commit e52ebcf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/wslu-header

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ fi
4040
# prevent bash -x
4141
set +x
4242

43+
bash_version_major=$(echo $BASH_VERSION | cut -d'.' -f1)
44+
4345
# pipeline content to pipe... if it is wslclip
4446
if [[ "$wslu_util_name" == "wslclip" ]]; then
4547
if [[ -p /dev/stdin ]]; then
@@ -150,6 +152,11 @@ function error_echo {
150152
exit "$2"
151153
}
152154

155+
# Check if the major version number is greater than 5
156+
if [ $(expr $bash_version_major \> 5) -ne 1 ]; then
157+
error_echo "You should use Bash 5 and higher; exiting." 1
158+
fi
159+
153160
# source default config
154161
if [ -f "${wslu_dest_dir}${wslu_prefix}/share/wslu/conf" ]; then
155162
debug_echo "source default setting"

0 commit comments

Comments
 (0)