Answer the question
In order to leave comments, you need to log in
Is it possible to use a variable from bash in expect?
I'll outline the gist.
On a remote machine, I need to get the user's UID. Then you need to perform actions on the same remote machine using this UID. Those. it must be obtained and somehow stored in a variable that would then be used.
query like this
send "cat /etc/passwd | grep myuser | awk -F ":" '{print $3}'\r"
send "cat /etc/passwd | grep myuser >info.txt\r"
Answer the question
In order to leave comments, you need to log in
On a remote machine, I need to get the user's UID. Then you need to perform actions on the same remote machine using this UID. Those. it must be obtained and somehow stored in a variable that would then be used.
myvar=`cat /etc/passwd | grep myuser | awk -F ":" '{print $3}'\r`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question