bug-bash
[Top][All Lists]
Advanced

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

Re: bash -n doesn't seem to catch all syntax errors...


From: Jan Schampera
Subject: Re: bash -n doesn't seem to catch all syntax errors...
Date: Tue, 16 Oct 2007 05:35:55 +0200
User-agent: IceDove 1.5.0.12 (X11/20070607)

Ken Failbus wrote:

> When I specify on command-line "bash -n <myscript name>". Bash doesn't
> check for valid syntax errors. E.g. if variable is missing a "$" infront
> of it while assigning a value. This is not catched by bash.

> ### example code
> p=hello
> e=world
> If [ p != $e ];then
>       echo "not equal"
> else
>       echo "equals"
> fi

This is perfectly valid code, it would be an error/bug to complain here,
on a syntax check.

Also you should use more quotes for your parameter expansions:
- http://bash-hackers.org/wiki/doku.php?id=syntax:words
- http://www.grymoire.com/Unix/Quote.html

J.





reply via email to

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