Answer the question
In order to leave comments, you need to log in
How to get the value of variables after executing a script remotely via ssh?
Good afternoon!
Please tell me how to solve the problem.
There is a machine 'A' and 'B'
Machine 'A' a script that ssh to machine 'B' and runs the script.
The script is executed, puts something into text files, copies something. Initializes some variables. And now the question is how can I remotely pull out the value of the variables to my machine 'A'.
A-> ssh [email protected] "cd /to/script && ./script.sh"
B->cat script.sh
a=`ls -l | grep 'info`
b=`dmesg | grep 'error'`
c=`date`
do
$a $b $c
done
ssh [email protected] "cd /to/script && ./script.sh"
echo $a $b $c
Answer the question
In order to leave comments, you need to log in
Add a line to the script.sh file
. After that, it will be possible to get the values in this way
And, accordingly, process:
for command in $RESULT
do
echo $command
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question