FG
💻 Software

Run python oneliner in bash script

Fresh7 days ago
Mar 15, 202623370 views
Confidence Score0%
0%

Problem

The following is the python one-liner I want to run as part of my bash script (pom.xml is a maven POM xml file) I want to have the result of the command be assigned to variable MVN_VER This is my base script: However it fails to run. If I run the script with +x option, it is what I see: I think it …

Error Output

python -c "from xml.dom.minidom import parse;dom = parse('/path/to/pom.xml');print [n.firstChild.data for n in dom.childNodes[0].childNodes if n.firs…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Run python oneliner in bash script

Low Risk

There is no need for escaping or moving the argument to its own variable. But, keeping it mostly the same, the following works for me: is the example minimal POM from the Maven docs: Output: Please throw away your code and just use mine (after adjus…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment