Re: Option "-n" not working reliably and poorly documented
From:
Paul Jarc
Subject:
Re: Option "-n" not working reliably and poorly documented
Date:
Wed, 11 Feb 2009 15:04:41 -0500
User-agent:
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)
Ronny Standtke <ronny.standtke@fhnw.ch> wrote:
> The "-n" option not seem to work. Example with a little stupid nonsense
> script:
> -----------
> ronny@ronny-desktop:/tmp$ cat test.sh
> #!/bin/sh
> if [ $blah == "test"]
This sort of error can't be caught by -n, because it's part of a
specific command, not the shell grammar. Checking for ] is done when
the [ command is executed. Since -n disables execution of all
commands, [ won't have a chance to check for a matching ].
> Another strange thing: The man page of bash does only implicitly mention
> the "-n" option in the description of the "-D" option: "This implies the
> -n option; no commands will be executed."
It's documented under the "set" builtin.
paul