Script

MendesFerreira Messages postés 2 Statut Membre -  
zipe31 Messages postés 38797 Statut Contributeur -
Bonsoir,
Je suis en train de faire un script pour la connexion a distance ssh que contient 4 paramettres:
J'ai commencé mais je suis bloquer voici ce que j'ai fait:
#!/bin/bash
echo AFFICHER MENU ACCÈS SÉCURISÉS
echo ---------------------------------
echo "veuliez choisir une option ? " :
echo 1 -Accès SSH Serveur web
echo 2 -Accès SSH Routeur-1
echo 3 -Accès SSH Srv-DNS
echo 99 -Sortir
echo choisissez :

read i;

if(i==1); then
{
echo Accès SSH serveur web
ssh root@"ip srv web"
}
elif(i==2); then
{
echo Accès SSH Routeur
ssh root@"srv-routeur"
}
elif(i==3); then
{
echo Accès Ssh Srv-DNS
ssh root@"srv dns"
}

else (i==4)
{
exit
}
fi;


PS : Je ne suis pas un programmeur merciii d'avance.
A voir également:

1 réponse

zipe31 Messages postés 38797 Statut Contributeur 6 433
 
Salut,

#!/bin/bash
echo AFFICHER MENU ACCÈS SÉCURISÉS
echo ---------------------------------
echo "veuillez choisir une option :"
echo 1 -Accès SSH Serveur web
echo 2 -Accès SSH Routeur-1
echo 3 -Accès SSH Srv-DNS
echo 4 -Sortir
echo choisissez :

read i;

case "${i}" in
1) echo Accès SSH serveur web
ssh root@"ip srv web"
;;
2) echo Accès SSH Routeur
ssh root@"srv-routeur"
;;
3) echo Accès Ssh Srv-DNS
ssh root@"srv dns"
;;
*) exit
;;
esac

0