hybby / sshb

just an ssh batch command. i use it too often not to save it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sshb - an ssh batch command

i use this far too often not to have it saved here.

pop hosts into a file called hostfile or similar.

set up ssh-agent (presuming your ssh keys are already set up)

eval $(ssh-agent)
ssh-add

for i in $(cat hostlist) ; do
  ./sshb $i 'echo "hello world!"'
done

gives output like

[performing echo "hello world!" on myserver]
hello world!
(return code: 0)

remember escapes, quoting, variable interpolation, et al.

also, those nice status bars are all printed on stderr. so if you don't want them, just 2>/dev/null

About

just an ssh batch command. i use it too often not to save it.