Bash scripting hell