help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to echo the output of a shell command and preserve the newlines


From: Ploppz
Subject: Re: How to echo the output of a shell command and preserve the newlines
Date: Tue, 25 Aug 2015 10:40:29 -0700 (PDT)

Ah, thanks! I was a bit confused in what degree I can rely on bash/shell
functionality in make. Is the body of rules just plain sh or something else?

On Tue, Aug 25, 2015 at 7:33 PM, Paul Smith-20 [via Gnu - Make] <
address@hidden> wrote:

> On Tue, 2015-08-25 at 10:28 -0700, Ploppz wrote:
> > Hi. I have this line:
> >         echo "$(shell ~/scripts/make/getshadernames src)" | sed
> > 's/\(.*\)/\textern
> > char const * const \1;/g' >> src/shaders.h
> >
> > getshadernames prints out one name on each line. My problem is that
> > what is send to sed via the pipe, is only one long line - with
> > newlines removed. How can I fix that?
>
> Why are you using the $(shell ...) function in a recipe?  The recipe is
> already running in a shell!
>
> Why not just:
>
>     $$HOME/scripts/make/getshadernames src | sed ... >> src/shaders.h
>
> ?
>
>
> _______________________________________________
> Help-make mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=16496&i=0>
> https://lists.gnu.org/mailman/listinfo/help-make
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://gnu-make.2324884.n4.nabble.com/How-to-echo-the-output-of-a-shell-command-and-preserve-the-newlines-tp16494p16496.html
> To unsubscribe from How to echo the output of a shell command and preserve
> the newlines, click here
> <http://gnu-make.2324884.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=16494&code=M3JsZW5kaGxAZ21haWwuY29tfDE2NDk0fC0zNTk0NzAzMTE=>
> .
> NAML
> <http://gnu-make.2324884.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://gnu-make.2324884.n4.nabble.com/How-to-echo-the-output-of-a-shell-command-and-preserve-the-newlines-tp16494p16497.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.


reply via email to

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