help-bash
[Top][All Lists]
Advanced

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

Re: Help with String Extraction


From: Greg Wooledge
Subject: Re: Help with String Extraction
Date: Tue, 17 Sep 2024 14:51:52 -0400

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]