« Linux : Script avec expect » : différence entre les versions

De www.yakakliker.org
Aucun résumé des modifications
Aucun résumé des modifications
 
(Une version intermédiaire par le même utilisateur non affichée)
Ligne 44 : Ligne 44 :
[[Catégorie:Scripts]]
[[Catégorie:Scripts]]
[[Catégorie:Expect]]
[[Catégorie:Expect]]
‎<html>
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
<script>
  kofiWidgetOverlay.draw('yakakliker', {
    'type': 'floating-chat',
    'floating-chat.donateButton.text': 'Café',
    'floating-chat.donateButton.background-color': '#00b9fe',
    'floating-chat.donateButton.text-color': '#fff'
  });
</script>
‎</html>
‎<html>
<a href="https://www.compteurdevisite.com" title="compteur web gratuit sans pub"><img src="https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx" border="0" title="compteur web gratuit sans pub" alt="compteur web gratuit sans pub"></a>
‎</html>

Dernière version du 17 février 2025 à 17:56

#!/usr/bin/expect

set timeout 20

set ip [lindex $argv 0]

set user [lindex $argv 1]

set password [lindex $argv 2]



spawn ssh -o "StrictHostKeyChecking no" "$user\@$ip"
expect "password:"

send "$password\r";
expect "# "

send "apt-get update\r"
expect "# "

send "apt-get upgrade -y && exit\r"
expect "# "

send "ls\r"
expect "# "

send -- "\r"

send "exit\r"
expect "# "

send "exit\r"


interact
#expect eof

Lien

https://phoenixnap.com/kb/linux-expect


compteur web gratuit sans pub