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

msieczka wrote (Wed, Mar 28 2007 15:50:39):

In current 6.3 CVS there are several instances of "echo -e", which is a
bashism. In dash "echo -e" will just print '-e' string.

lib/gis/Makefile: echo -e "#include <stdlib.h>\n#include
<fcntl.h>\n#undef _fmode\nint _fmode = _O_BINARY;" > $(OBJDIR)/fmode.c

lib/init/grass-run.src: echo -e "\033]0;${TITLE}\007\c"

lib/init/grass-run.src: echo -e "\r"

These two instances make the grass-run.sh affected as well. "-e" is a bashism.
Since grass-run.sh has a "#!/bin/sh" shebang, even in bash in runs in a POSIX
shell compliant, thus prints spurious "-e"'s into the terminal.

Maciek

-------------------------------------------- Managed by Request Tracker

Maciek Sieczka via RT wrote:

> In current 6.3 CVS there are several instances of "echo -e", which
> is a bashism. In dash "echo -e" will just print '-e' string.

> lib/gis/Makefile: echo -e "#include <stdlib.h>\n#include
> <fcntl.h>\n#undef _fmode\nint _fmode = _O_BINARY;" >
> $(OBJDIR)/fmode.c

left to someone else to fix. (I'm not big on Makefile fu)

> lib/init/grass-run.src: echo -e "\033]0;${TITLE}\007\c"
> lib/init/grass-run.src: echo -e "\r"

These two instances make the grass-run.sh affected as well. "-e" is a
bashism. Since grass-run.sh has a "#!/bin/sh" shebang, even in bash in
runs in a POSIX shell compliant, thus prints spurious "-e"'s into the
terminal.

fixed in CVS.

Hamish

Maciek Sieczka via RT wrote:

> In current 6.3 CVS there are several instances of "echo -e", which is a
> bashism. In dash "echo -e" will just print '-e' string.

> lib/gis/Makefile: echo -e "#include <stdlib.h>\n#include
> <fcntl.h>\n#undef _fmode\nint _fmode = _O_BINARY;" > $(OBJDIR)/fmode.c

I suggest putting the code into e.g. fmode.dat then using:

  cat fmode.dat > $(OBJDIR)/fmode.c

It can't be a normal .c file, as the default rules automatically
compile all .c files and link the resulting objects into the library.

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