I have multiple hosts(more than 20) and need to execute the command but it is not working as expected . The individual command is working on all the hosts
ps -ef |grep \`cat/z/y/x|tail -1| awk '{print$30}'\`
Script:
for hsts in `cat /a/b/c/hsts.txt`
do
ssh ${id}@${hsts} "cat /z/y/x|tail -1" | awk '{print $30}'
done
the above snippet will give me the process id on all the hosts . i want to know which process is running with this process id and i am trying to use the below command , but it is not working out . Any thoughts what i am missing .
ssh ${id}@{hsts} ps -ef |grep "cat/z/y/x/tail -1" |awk '{print $30}'
# above command is not working when i use in the above do loop