Skip to content

Commit

Permalink
fix: [#294] add bash version requirement.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick330602 committed Dec 30, 2023
1 parent ea34a92 commit e52ebcf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/wslu-header
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ fi
# prevent bash -x
set +x

bash_version_major=$(echo $BASH_VERSION | cut -d'.' -f1)

# pipeline content to pipe... if it is wslclip
if [[ "$wslu_util_name" == "wslclip" ]]; then
if [[ -p /dev/stdin ]]; then
Expand Down Expand Up @@ -150,6 +152,11 @@ function error_echo {
exit "$2"
}

# Check if the major version number is greater than 5
if [ $(expr $bash_version_major \> 5) -ne 1 ]; then
error_echo "You should use Bash 5 and higher; exiting." 1
fi

# source default config
if [ -f "${wslu_dest_dir}${wslu_prefix}/share/wslu/conf" ]; then
debug_echo "source default setting"
Expand Down

0 comments on commit e52ebcf

Please sign in to comment.