How can I store output string to a variable AND display in console

chris yo

I have a perl script that prints a message. This script is being called by GNU make. In my GNU make, I want to display the message printed out by the script AND store it in a variable also.

I'm doing it this way.

 result=`$(PERL) parse.pl report.log` #parse the report
 echo $(result) #echo the message here
 ifneq ($(strip $$(result)),) #check if message is empty
   #if not empty, search for filepath string pattern and exit
   echo filepath
   exit 1
 endif

But it is not displaying the string message from parse.pl.

ysth

You are capturing into a shell variable, but then trying to echo a makefile variable (and even if you tried to echo the shell variable, that wouldn't work because make runs each line in a separate shell process).

Changing it to echo the shell varible and all to run in one shell should work:

foo:
    result=`$(PERL) parse.pl report.log`; \
    echo $$result

but whatever you later need to do to use the captured result would also need to be in the same shell execution.

Apparently you can capture into a makefile variable too, which may be more convenient:

foo:
    $(eval result := $(shell $(PERL) parse.pl report.log))
    echo $(result)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how can I display and update a variable?

From Dev

How can I display JSON data in angularJS if the key is variable?

From Dev

How can I display a javascript variable multiple times in html?

From Dev

How can I display a div as many times as is stored in a PHP variable?

From Dev

how to store function value in variable and display it on textarea

From Java

How can I update a variable to display some text, have a delay, then update another variable also displaying text?

From Dev

How to display string and variable in same thing?

From Dev

How to store results of the foreach which is a list into variable and display it in popup window

From Dev

Bash: How can I display the content of an environment variable from within a script?

From Dev

How can I display the contents of a variable that uses .sum() in a label using tkinter

From Dev

Pygame how do I display a variable?

From Dev

In an iOS View, how can I display a list or table of an object's variable values, hiding rows where the variable's value is nil?

From Dev

Display a string variable in a textbox

From Dev

Can't display variable

From Dev

How to display img inside twig with variable + string concatenate?

From Dev

How do I display the value of a jQuery variable for testing?

From Dev

How do I display the value of a variable ( key ) in a html page?

From Dev

How do I display the value of a variable ( key ) in a html page?

From Dev

Batch File - How do I display a precent of a variable?

From Dev

How do I get my timeStamp variable to display the correct date?

From Dev

How do I set up Tkinter in python to display and update a variable?

From Dev

Laravel: How to store href id in the new variable and display or use in the input field?

From Dev

Display a variable's name along with output?

From Dev

Matlab Display variable output in dialog box

From Dev

Display a variable's name along with output?

From Dev

How to read numbers; How to store those numbers in variable; and how to display those numbers in a label; from line edit in Qt?

From Dev

Store variable from input box and display value in p tag

From Dev

Store in MySQL and display variable amount of rows in HTML table

From Dev

In codeigniter i am send a php variable from view page to controller through the <a> tag, but i can't display value in controller page

Related Related

  1. 1

    how can I display and update a variable?

  2. 2

    How can I display JSON data in angularJS if the key is variable?

  3. 3

    How can I display a javascript variable multiple times in html?

  4. 4

    How can I display a div as many times as is stored in a PHP variable?

  5. 5

    how to store function value in variable and display it on textarea

  6. 6

    How can I update a variable to display some text, have a delay, then update another variable also displaying text?

  7. 7

    How to display string and variable in same thing?

  8. 8

    How to store results of the foreach which is a list into variable and display it in popup window

  9. 9

    Bash: How can I display the content of an environment variable from within a script?

  10. 10

    How can I display the contents of a variable that uses .sum() in a label using tkinter

  11. 11

    Pygame how do I display a variable?

  12. 12

    In an iOS View, how can I display a list or table of an object's variable values, hiding rows where the variable's value is nil?

  13. 13

    Display a string variable in a textbox

  14. 14

    Can't display variable

  15. 15

    How to display img inside twig with variable + string concatenate?

  16. 16

    How do I display the value of a jQuery variable for testing?

  17. 17

    How do I display the value of a variable ( key ) in a html page?

  18. 18

    How do I display the value of a variable ( key ) in a html page?

  19. 19

    Batch File - How do I display a precent of a variable?

  20. 20

    How do I get my timeStamp variable to display the correct date?

  21. 21

    How do I set up Tkinter in python to display and update a variable?

  22. 22

    Laravel: How to store href id in the new variable and display or use in the input field?

  23. 23

    Display a variable's name along with output?

  24. 24

    Matlab Display variable output in dialog box

  25. 25

    Display a variable's name along with output?

  26. 26

    How to read numbers; How to store those numbers in variable; and how to display those numbers in a label; from line edit in Qt?

  27. 27

    Store variable from input box and display value in p tag

  28. 28

    Store in MySQL and display variable amount of rows in HTML table

  29. 29

    In codeigniter i am send a php variable from view page to controller through the <a> tag, but i can't display value in controller page

HotTag

Archive