S
S
split_horizon2020-03-06 09:04:28
linux
split_horizon, 2020-03-06 09:04:28

How to pass stdout to a variable in Linux?

Hello!
I have a python script that, when executed, outputs the name of the file being created.
How can I assign a value to a variable - the name of this file, so that I can then execute another command through the pipe?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aborigen1020, 2020-03-06
@split_horizon

Question about Linux or python functionality?
If the first, then:

#!/bin/bash
some_var=$(python some_script.py)
echo $some_var

Note that such a command will execute python some_script.pybefore the commandecho

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question