Fix bash loop and cutting
Merge pull request #288 from njam/issue-288

Fix set-write-cache-off