#1 Le 22/02/2017, à 10:39
- Crestey
[Résolu] Commande "spawn" ne fonctionne plus
Bonjour à tous,
Sur ce fil, j'avais ce script qui a fonctionné pendant des années.
#!/bin/sh
#!/usr/bin/expect -f
# Open a telnet session to a remote server, and wait for a username prompt.
set var [lindex $argv 0]
spawn telnet 192.168.0.20
# Send the prebuilt command, and then wait for another shell prompt.
if { "$var" == "p" } { send "chattr +i -R /mnt/HD_a2/Souvenirs\r" }
if { "$var" != "p" } { send "chattr -i -R /mnt/HD_a2/Souvenirs\r" }
# send "chattr $var -R /mnt/HD_a2/Souvenirs\r"
expect "%"
# Exit the telnet session, and wait for a special end-of-file character.
send "exit\r"
expect eof
Maintanant la commande "spawn" ne passe plus ! ? :
crestey1@PC1:~$ ./tn p
./tn: 5: ./tn: spawn: not found
./tn: 14: ./tn: Syntax error: end of file unexpected (expecting "}")
crestey1@PC1:~$
Quelqu'un a-t-il une idée ?
Dernière modification par Crestey (Le 22/02/2017, à 10:50)
Merci à tous.
Sous Ubuntu/XFCE depuis 2013. Ça fonctionne vraiment très bien.
Hors ligne
#2 Le 22/02/2017, à 10:47
- credenhill
Re : [Résolu] Commande "spawn" ne fonctionne plus
hello
enlever
#!/bin/sh
Hors ligne
#3 Le 22/02/2017, à 10:50
- Crestey
Re : [Résolu] Commande "spawn" ne fonctionne plus
Merci beaucoup, c'est bien ça !
Sinon saurais-tu pourquoi ça marchait quand même avant ?
Merci à tous.
Sous Ubuntu/XFCE depuis 2013. Ça fonctionne vraiment très bien.
Hors ligne
#4 Le 22/02/2017, à 10:58
- credenhill
Re : [Résolu] Commande "spawn" ne fonctionne plus
avant quoi ?
le #!/bin/sh étai-il présent ?
comment était exécuté le script ?
Hors ligne
#5 Le 22/02/2017, à 11:22
- Crestey
Re : [Résolu] Commande "spawn" ne fonctionne plus
Désolé, c'est une erreur de ma part. Je ne sais pas dite comment #!/bin/sh s'est introduite dans le script que j'avais archivé. Mille excuses.
Merci à tous.
Sous Ubuntu/XFCE depuis 2013. Ça fonctionne vraiment très bien.
Hors ligne