Subject: d.out.png script copied to docs/html/ in err
Hi,
I just noticed that the d.out.png script is copied to $GISBASE/docs/html/.
I guess the Makefile figures it is an image for the help page.
Right.
How to get
-for file in *.png *.jpg ; do \
head -1 $$file | grep '#!/bin/sh' > /dev/null \
if [ $$? -ne 0 ] ; then
$(INSTALL_DATA) $$file $(GISBASE)/docs/html \
fi \
done 2> /dev/null ; true
working (in include/Make/Html.make)?
The problem is that $$? isn't found. Maybe there is a less ugly trick to
test if
the first file of the $$file is a shell script.
Markus
Hamish
-------------------------------------------- Managed by Request Tracker
-for file in *.png *.jpg ; do \
head -1 $$file | grep '#!/bin/sh' > /dev/null \
if [ $$? -ne 0 ] ; then
$(INSTALL_DATA) $$file $(GISBASE)/docs/html \
fi \
done 2> /dev/null ; true
working (in include/Make/Html.make)?
The problem is that $$? isn't found. Maybe there is a less ugly trick to
test if
the first file of the $$file is a shell script.
I'm no expert but shouldn't
-for file in *.png *.jpg ; do \
if [ ! -x $$file ] ; then \
$(INSTALL_DATA) $$file $(GISBASE)/docs/html \
fi \
done 2> /dev/null ; true
do the trick since shellscript should be executable?
-for file in *.png *.jpg ; do \
if [ `head -1 $$file` != '#!/bin/sh' ] ; then
$(INSTALL_DATA) $$file $(GISBASE)/docs/html \
fi \
done 2> /dev/null ; true
Checking if a file is excutable could be unreliable in a certain environment.
Huidae Cho
On Wed, May 24, 2006 at 06:00:43PM +0300, Wolf Bergenheim wrote:
On Wed, 24 May 2006, Markus Neteler wrote:
>How to get
> -for file in *.png *.jpg ; do \
> head -1 $$file | grep '#!/bin/sh' > /dev/null \
> if [ $$? -ne 0 ] ; then
> $(INSTALL_DATA) $$file $(GISBASE)/docs/html \
> fi \
> done 2> /dev/null ; true
>working (in include/Make/Html.make)?
>The problem is that $$? isn't found. Maybe there is a less ugly trick to
>test if
>the first file of the $$file is a shell script.
I'm no expert but shouldn't
-for file in *.png *.jpg ; do \
if [ ! -x $$file ] ; then \
$(INSTALL_DATA) $$file $(GISBASE)/docs/html \
fi \
done 2> /dev/null ; true
do the trick since shellscript should be executable?
>this bug's URL: http://intevation.de/rt/webrt?serial_num=4498
>-------------------------------------------------------------------------
>
>Subject: d.out.png script copied to docs/html/ in err
>
>Hi,
>
>I just noticed that the d.out.png script is copied to $GISBASE/docs/html/.
>I guess the Makefile figures it is an image for the help page.
Right.
How to get
-for file in *.png *.jpg ; do \
head -1 $$file | grep '#!/bin/sh' > /dev/null \
if [ $$? -ne 0 ] ; then
$(INSTALL_DATA) $$file $(GISBASE)/docs/html \
fi \
done 2> /dev/null ; true
working (in include/Make/Html.make)?
Add some semicolons, and a backslash.
The above is equivalent to two separate command lines, both erroneous:
-for file in *.png *.jpg ; do head -1 $$file | grep '#!/bin/sh' > /dev/null if [ $$? -ne 0 ] ; then
$(INSTALL_DATA) $$file $(GISBASE)/docs/html ; fi done 2> /dev/null ; true
The missing backslash after the "then" causes the command to be split
into two, each executed by a separate invocation of "/bin/sh -c ...";
as the do/done and if/fi are both split in half, that won't work.
Also, the missing semicolons before the "if" and the "done" will
result in syntax errors.
Also, I would just check for #! at the beginning of the line;
#!/bin/sh is too specific (e.g. you could have a space after the #!,
or it might be a script in some other language). Any file which begins
with #! is treated as a script by the kernel (i.e. exec()ing the file
will execute the program whose path follows the #! with the script's
path given as an argument).
Finally, "head -n 1" may be more portable than "head -1" (recent
versions generate a warning).
Try:
-for file in *.png *.jpg ; do \
head -n 1 $$file | grep '^#!' > /dev/null ; \
if [ $$? -ne 0 ] ; then \
$(INSTALL_DATA) $$file $(GISBASE)/docs/html ; \
fi \
done 2> /dev/null ; true