greycat 1179858864 learn When you're trying to find your mistake in a shell script, make the script SMALLER. Smaller is better. Reduce your code to the bare minimum size that still shows the problem. You'll probably end up fixing it yourself in the process.