Use double quotes around all variable references (for example, "$i" ) to prevent word separation. BTW, it looks like your script will fail if more than one element appears in / Volumes / Daten / fake, because ./* at the end of the hdiutil command will try to include all the elements in each image, which will also fail. Finally, ./* usually not required; just use * . I think you want this:
#!/bin/sh cd /Volumes/Daten/fake for i in *; do hdiutil makehybrid -udf -joliet -iso -o "/Volumes/Daten/test/$i" "$i" done
source share