[GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh

Glynn Clements glynn at gclements.plus.com
Mon Feb 19 11:41:47 EST 2007


Hamish wrote:

> (my regex sucks, what does the "\\s*" part of "\\s*:\\s*" match?)

My guess would be that it's supposed to match any "whitespace"
character, but that's non-standard (it works in GNU sed 4.1.5, but
doesn't appear to be documented in the sed Info file). More portable
solutions include:

1. Just use a space.

2. Use a set containing a space or a tab, i.e. [ <tab>] where <tab> is
a literal tab character.

3. Use [:space:] or [:blank:]. The latter matches space or tab, while
the former matches a locale-dependent set; in the C/POSIX locale, it
matches space, tab, newline, carriage-return, form-feed and
vertical-tab.

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




More information about the grass-dev mailing list