bash - How to pipe a here-document through a command and capture the result into a variable? -


Now this value is required on stdout. How can I capture it in a variable, so that I can use it in the other script?

Prerequisites:

  • The script needs all in one file.
  • If possible, I do not want to write a temporary file

.

  #! / Bin / bash cat & lt; & Lt; EOF | XSLTProx - ../pom.xml | Tail-1 & lt ;? XML version = "1.0"? & Gt; & Lt; Xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/XSL/transform" & gt; & Lt; Xsl: template match = "/" & gt; & Lt; Xsl: Select Value = "/ Project / Version" /> & Lt; / Xsl: Templates & gt; & Lt; / XSL: stylesheet & gt; EOF  

It starts working (based on the answer to Ignaceo). Using a subshell here-papers are pipe right in the XSLTproc, while it is crossed even after tail.

  VERSION = $ ((xsltproc - ../pom.xml | tail -1) & lt; EOF   gt;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -