-4

Script1

for machine in host name; do
  ssh user@$machine /bin/bash << EOF
uname -a
lscpu  | grep "^CPU(s)"
grep -i memtotal /proc/meminfo
EOF
done

Script 2

for machine in Host Name; do
  ssh user@$machine /bin/bash<<< 'lshw;cat /etc/resolv.conf'
done

I have these two separate script how can i join this script as one

  • 3
    Put all commands between the two EOF's seperated by ; – Mikael Kjær Dec 12 '17 at 5:13
0

Here is the desired result:

for machine in host name; do
  ssh user@$machine /bin/bash << EOF
uname -a
lscpu  | grep "^CPU(s)"
grep -i memtotal /proc/meminfo
lshw
cat /etc/resolv.conf'
EOF
done

As suggested in comment you need to add the remote commands from second script between inline delimiters (EOF in your case)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.