Create .CHD From .CUE Files

Windows 
 cue2chd.bat 
 for /r %%i in (*.cue) do chdman createcd -i "%%i" -o "%%~ni.chd" >> log 
 
 Linux 
 convertFromCueToChd.sh 
 parallel chdman createcd -i {} -o {.}.chd ::: *.cue 
   
 The below script and the attached version above does not work. Need to test and change accordingly. 
 #!/bin/bash

# Grab .cue file
for f in ./**/*.cue
do
	name=${f%.cue} # Remove '.cue' from file name
	chdman createcd -i "$name.cue" -o "$name.chd" --force
done