Merci, problème résolu ! (merci a stackoverflow aussi mdr)
#!/bin/bashmonPath="/media/cloud"
su pi -c "mount $monPath"
grep -q " ${monPath}" /etc/mtab
if[$?="0"];thenecho"montage effectif"elseecho"montage not work"fi
su pi -c "umount $monPath"
grep -q " ${monPath}" /etc/mtab renvoie 0 quand c'est bon et 1 quand c'est pas bon (comme expliqué par totof2000 ci-haut d'ailleurs ^ ^ )
[^] # Re: Chez moi ça marche...
Posté par EauFroide . En réponse au message [RÉSOLU] Bash utiliser variable dans une commande du style result=$(commande | grep $variable). Évalué à 1. Dernière modification le 26 mai 2017 à 15:35.
Merci, problème résolu ! (merci a stackoverflow aussi mdr)
grep -q " ${monPath}" /etc/mtab renvoie 0 quand c'est bon et 1 quand c'est pas bon (comme expliqué par totof2000 ci-haut d'ailleurs ^ ^ )
Donation Bitcoin : 1N8QGrhJGWdZNQNSspm3rSGjtXaXv9Ngat