Avoid error is WSL is not defined
authorKrzGalcz <k.galczynski@eyeo.com>
Wed, 13 Nov 2024 15:30:34 +0100
changeset 25713 bf90446a27cb
parent 25712 990d3ed1b36b
child 25714 074ea5523f84
Avoid error is WSL is not defined
pre-commit-src/pre-commit-script.sh
--- a/pre-commit-src/pre-commit-script.sh
+++ b/pre-commit-src/pre-commit-script.sh
@@ -35,17 +35,17 @@ fi
 # Mac grep doesn't have Perl regex, therefor it needs to be checked with another method
 if [ $OSTYPE = 'darwin'* ]; then
     alias grep='ggrep'
 else
     alias grep='command grep'
 fi
 
 # In case on WSL (Windows) it's faster to invoke git.exe directly from Windows (since the files are in the windows FS).
-if [ -n $(echo $WSL_DISTRO_NAME || echo '') ]; then
+if [ -n "${WSL_DISTRO_NAME:-}" ]; then
     alias git='git.exe'
 else
     alias git='command git'
 fi
 
 error_handler() {
     local exit_code=$?
     local line_number=$1