Merci à tous de vos conseils et réponses! Comme vous vous en doutez je débute donc j'ai vraiment du mal encore ^^ J'ai tenté une réécriture donc mais ne marche plus je suis paumé là :/
#!/bin/bash
##### Var Locations #####
#Primaire A
prim_a='toto@192.168.0.0'
#Maternelle A
mat_a='toto@192.168.0.0'
#Primaire St
prim_st='toto@192.168.0.0'
#Primaire St-Classe Mobile
prim_st_mob='toto@192.168.0.0'
#Maternelle St
mat_st='toto@192.168.0.0'
#Primaire C
prim_c='toto@192.168.0.0'
##### Var Zenity #####
selection=$(zenity --list "Primaire A" "Maternelle A" "Primaire St " "Primaire St-Classe Mobile" "Maternelle St" "Primaire C" --column="" --text="" --title="SCRIPT MAINTENANCE" --width=300 --height=500 2>/dev/null)
##### Var Commandes #####
## 1er cssh -> bloquage pc ##
commande1="cssh --autoclose 1 --quiet --action "export DISPLAY=:0.0 2>/dev/null ; export XAUTHORITY=$(eval echo ~`who | grep tty7 | sed 's/\([a-z]*\).*/\1/'`)/.Xauthority 2>/dev/null ; zenity --warning --text 'MAINTENANCE_EN_COURS_MERCI_DE_NE_PAS_UTILISER_CET_ORDINATEUR' 2>/dev/null | xtrlock 2>/dev/null " $ip"
## 2eme cssh -> connexion pour maintenance ##
commande2="cssh $ip"
## 3eme cssh -> fermeture zenity/xtrlock (bloquage)
commande3="cssh --autoclose 1 --quiet --action "pkill -9 'zenity' ; pkill -9 'xtrlock'" $ip"
##### Var Choix et Connexion #####
if [ $selection = Primaire\ A ]
then
ip=$prim_a
$commande1
$commande2
$commande3
elif [ $selection = Maternelle\ A ]
then
ip=$mat_a
$commande1
$commande2
$commande3
elif [ $selection = Primaire\ St ]
then
ip=$prim_st
$commande1
$commande2
$commande3
elif [ $selection = Primaire\ St–Classe\ Mobile ]
then
ip=$prim_st_mob
$commande1
$commande2
$commande3
elif [ $selection = Maternelle\ St ]
then
ip=$mat_st
$commande1
$commande2
$commande3
elif [ $selection = Primaire\ C ]
then
ip=$prim_c
$commande1
$commande2
$commande3
else
echo "ERREUR"
fi
J'ai les souçis suivant :
-bin/bash introuvable (pourtant bien présent quand je fais ls /bin/)
-Plus "simplement" les commandes cssh font n'importe quoi ^^'
J'en demande beaucoup mais encore une fois merci à vous ! 🙂
Edit : J'ai corrigé les apostrophes (j'avais fais des copier/coller de cochon sous libre office^^')
+ #!/bin/bash
./maintenance3.0.sh: 1: ./maintenance3.0.sh: #!/bin/bash: not found
+ prim_aristide=toto@192.168.0.0
+ mat_arist=toto@192.168.0.0
+ prim_stju=toto@192.168.0.0
+ prim_stju_mob=toto@192.168.0.0
+ mat_stju=toto@192.168.0.0
+ prim_clap=toto@192.168.0.0
+ temp=toto@192.168.0.0
+ zenity --list Primaire A Maternelle A Primaire St Primaire St-Classe Mobile Maternelle St Primaire C Temporaire --column= --text= --title=SCRIPT MAINTENANCE --width=300 --height=500
+ selection=Temporaire
+ texte='MAINTENANCE_EN_COURS_MERCI_DE_NE_PAS_UTILISER_CET_ORDINATEUR'
+ commande1=cssh --autoclose 1 --quiet --action export DISPLAY=:0.0
+ grep tty7
+ sed s/\([a-z]*\).*/\1/
+ who
+ eval echo ~max
+ echo /home/max
+ export XAUTHORITY=/home/max/.Xauthority
+ xtrlock
+ zenity --warning --text MAINTENANCE_EN_COURS_MERCI_DE_NE_PAS_UTILISER_CET_ORDINATEUR
+ commande2=cssh
+ commande3=cssh --autoclose 1 --quiet --action pkill -9 zenity
./maintenance3.0.sh: 74: ./maintenance3.0.sh: -9: not found
+ pkill -9 xtrlock
+ [ Temporaire = Primaire A]
+ [ Temporaire = Maternelle A]
+ [ Temporaire = Primaire St]
+ [ Temporaire = Primaire St–Classe Mobile]
+ [ Temporaire = Maternelle St]
+ [ Temporaire = Primaire C]
+ [ Temporaire = Temporaire]
+ ip=max@192.168.0.38
+ cssh --autoclose 1 --quiet --action export
+ cssh
+