Extra whitespace around and after commands in shell scripts isn't generally a problem anyway. Your shell just ignores it. They normally only cause errors inside certain syntactical elements, such as with the
infamous [ command. Anyone with experience can easily spot these problem spaces.
The only place I can think of where a space would cause problems, and not be easily noticed, is when you use backslashes to split a command onto multiple lines. e.g.:
Code:
this is a very long command line with many arguments and so I am breaking \
it up onto two lines with a backslash.
The backslash escapes the non-printing newline character at the end of the line, so that the shell treats it as normal whitespace (i.e. it ignores it) instead of a command terminator. If you had a space character after it, then it would escape that instead, and the newline itself would still be "live".
A bigger problem is if you generate a script or input text file using Notepad or a similar Windows program, and then try to run it on a *nix box. Since Windows uses dos crlf line-endings, there will be extra non-printing carriage-return characters at the end of each line, which will likely cause syntax errors.
Edit: I just checked out the thread above, and am reminded that the terminating block of a here document is another potential pitfall location.
Also, another way to see non-printing characters in a file is to run it through
cat -A. It doesn't highlight spaces directly in any way, but it does highlight newlines, so there will be a gap between the final alphabetic character and the end of the line, if any exist there.