Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

4 votes
1 answer
1k views

Using a function's output (defined locally) inside SSH call

I have created a function function getqueue() { urlqueuename="urlcall" ouput=`curl $urlqueuename` queue=$(echo $ouput | jq -r '.queueName') echo $queue } I am using a ssh call ...
Ajith Sasidharan's user avatar
2 votes
1 answer
10k views

Send variable with EOF and use host variable [duplicate]

I want to send variable from source to host, and exec host script. Here is my code : var1=1 ssh -p 42 root@xxx /bin/bash << EOF var2=2 echo $var1 echo $var2 EOF Return : 1 var1=1 ssh -...
callmemath's user avatar
0 votes
2 answers
815 views

Environment variables over ssh block in shell script [duplicate]

I have the following function : GetHostName () { NODE01_CHECK=`cat /etc/hosts | grep -w "node01" | awk '{print $1}'` NODE02_CHECK=`cat /etc/hosts | grep -w "node02" | awk '{print $1}'` IS_NODE1=`...
robertpas's user avatar
3 votes
1 answer
391 views

View remote value of $PATH inside shell script

When executing this bash script, it only shows my local path. ssh ${REMOTE_HOST} 'bash -s' <<EOL set -e source ~/.profile echo $PATH # Commands here don't work because $PATH is ...
Flash's user avatar
  • 133