help-bash
[Top][All Lists]
Advanced

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

Re: Help with String Extraction


From: Steve Matzura
Subject: Re: Help with String Extraction
Date: Tue, 17 Sep 2024 15:13:16 -0400
User-agent: Mozilla Thunderbird Beta

Ah yes, the spaces were my downfall. Thank you. It all works as desired.


On 9/17/2024 2:51 PM, Greg Wooledge wrote:
On Tue, Sep 17, 2024 at 14:33:39 -0400, Steve Matzura wrote:
I want the output of the xmllint command to be put into a string variable.
I've tried braces, single- and double-quoting, parentheses, nothing works,
What you want is called "command substitution".  There are two different
syntaxes for this: backticks (deprecated) and $( ).

     myvariable=$( xmllint --whatever "$myfile" )

As others pointed out recently, there must NOT be any whitespace before
or after the = sign in a variable assignment.

The spaces that I put after $( and before ) are allowed, but not required.


reply via email to

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