windowsbashshellcmdermobaxterm

Bash Shell Script is not finding files using CMDER on Windows 10 but works on Linux


The problem is that when I use this part of a script, it works fine on a linux environment and in the rest of the code it returns the list of files. However, when using CMDER (Full version) on Windows 10, it simply returns "no .txt files found". So no .txt files found in defined path even though I have 3 .txt files there. I even tried MobaXterm and got the same results.

path=$1

#files with read permission in path
count=`find $path -type f -name '*.txt' -perm /a=r`

# at least one file found
if [ "X${count}" = "X" ]
then
  echo 'no .txt files found'
  exit 1
fi

Please note that I'm a beginner in shell scripting and really want to learn so any advice is greatly appreciated!


Solution

  • I fixed the problem by adding the following line at the end of user_profile inside the config folder

    set "PATH=%GIT_INSTALL_ROOT%\usr\bin;%PATH%"
    

    NOTE: there are other ways to fix it by this seemed to be the simplest way for me.