Answer the question
In order to leave comments, you need to log in
Can you help me with EXPECT?
Guys help me make the if then else loops correctly so that I can check expect
expect -c "
set timeout 120
spawn scp -r /home/administrator/crontab/ [email protected]$H:/home/administrator
expect password ;
send \"$password\n\" ;
expect \"scp>\""
then echo "OK" ; else echo "NO"; fi
if
expect -c "
set timeout 1
spawn ssh [email protected]$H;
expect password ;
send \"$password\n\" ;
expect *> ;
send \"sudo mkdir /home/user/.cron\n\" ;
expect password ;
send \"$password\n\" ;
expect *> ;
send \"sudo cp -f -rp /home/administrator/crontab/crontab/del.sh /home/user/.cron\n\" ;
expect *> ;
send \"sudo crontab -u user /home/administrator/crontab/crontab/reg\n\" ;
expect *> ;
send \"sudo rm -rf /home/administrator/crontab\n\" ;
expect \"ssh>\""
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question