Artificial intelligent assistant

ssh to server and switch user and then run multiple commands In a script, I am trying to ssh from within and then switch user and then trying to run multiple commands. Can you please help me out with this? Below is the example: ssh $a@$e << EOF sudo su hbase << EOF echo "list '"$tID":.*' " | /ignio/hbase/bin/hbase shell &> ListOutput cat ListOutput | grep "^"${tID}":" >ListOfTable while read line; do echo $line tableName=`echo $line | cut -d':' -f2` /hbase/bin/hbase org.apache.hadoop.hbase.mapreduce.Driver import $tID:$tablename hdfs:///backup/${tID} EOF EOF Thanks in advance!

Assuming you have passwordless sudo configured:


ssh user@host 'sudo -u sh -c hbase "command1;command2;command3"'


It may be better to put all the remote commands into a script then just run:


ssh user@host 'sudo -u hbase /some/script'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 17ee86ed1ba440a77bf0d82c0eb9ad44