[GRASS-dev] GRASS Initialization - typo

Glynn Clements glynn at gclements.plus.com
Wed Feb 3 23:09:57 EST 2010


Hamish wrote:

> > by screening the GRASS-Installer.nsi-script i've found some
> > typo,
> ...
> >  FileWrite $0 "'User break!' ; "    <= wrong order of the quotes
> 
> I'm pretty sure that's intended.
> The ! needs to be inside 'single' quotes to avoid being parsed.
> 
> $ echo "hello!"
> bash: !": event not found
> 
> $ echo 'hello!'
> hello!
> 
> (this may only happen from an interactive terminal,

It does only happen for an interactive shell; in a script, no quotes
are necessary:

	$ sh -c 'echo "User break!"'
	User break!
	$ sh -c 'echo User break!'
	User break!

But it wouldn't be the end of the world if the exclamation mark was
simply omitted.

As for issues with the .nsi syntax ... based upon a 30-second glance
at the documentation:

Strings can use single quotes, double quotes or backquotes, so you can
use backquotes to quote a string containing both single and double
quotes:

	FileWrite $0 `trap "echo 'User break!' ; exit" 2 3 9 15$\r$\n`

Or you can use "$\":

	FileWrite $0 "trap $\"echo 'User break!' ; exit$\" 2 3 9 15$\r$\n"

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list