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: Ken Failbus
Subject: RE: bash -n doesn't seem to catch all syntax errors...
Date: Tue, 16 Oct 2007 11:20:09 -0400

So how can bash script syntax be verified that includes shopt???
Is there more option on bash syntax command-line check that would make it 
identify this grammar???

Thanks for the quick reply.

Regards,
Ken
-----Original Message-----
From: Andreas Schwab [mailto:schwab@suse.de] 
Sent: Tuesday, October 16, 2007 10:14 AM
To: Ken Failbus
Cc: bug-bash@gnu.org
Subject: Re: bash -n doesn't seem to catch all syntax errors...

"Ken Failbus" <failbus@ulticom.com> writes:

> bash -x /tmp/mydummy   
> + shopt -s extglob
> + rm -f '/tmp/file.+([0-9])'
> + exit 0
>
> But if "bash -n" is run it doesn't understands +([0-9})
> bash -n /tmp/mydummy
> /tmp/mydummy: line 3: syntax error near unexpected token `/tmp/file.+(['
> /tmp/mydummy: line 3: `rm -f /tmp/file.+([0-9])'
>
> Can you provide insight into this.

shopt changes the shell grammar. When it's not executed the modified
grammar is not accepted.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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