Script

MendesFerreira Messages postés 2 Date d'inscription   Statut Membre Dernière intervention   -  
zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention   -
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.

1 réponse

  1. zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention   6 501
     
    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