[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Option "-n" not working reliably and poorly documented

From: Jon Seymour
Subject: Re: Option "-n" not working reliably and poorly documented
Date: Thu, 12 Feb 2009 07:58:12 +1100

Not sure this is correct. The ] is parsed by the shell but only if it surrounded by whitespace. This is why the -n option reports an error, since -n suppresses command execution.

I suspect the behaviour is required by posix or at least historical precedent.


On 12/02/2009, at 7:04, address@hidden (Paul Jarc) wrote:

Ronny Standtke <address@hidden> wrote:
The "-n" option not seem to work. Example with a little stupid nonsense
address@hidden:/tmp$ cat test.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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]