Je viens de tester avec le code suivant et ça fonctionne
FONCTIONNE
#!/bin/bashmonPath="/media/cloud"
su pi -c "mount $monPath"result=$(eval"mount | grep ${monPath} | wc -l")if[$result="1"];thenecho"montage effectif"elseecho"montage not work"fi
su pi -c "umount $monPath"
NE FONCTIONNE PAS
#!/bin/bashmonPath="/media/cloud"
su pi -c "mount $monPath"eval"mount | grep ${monPath} | wc -l"if[$?="1"];thenecho"montage effectif"elseecho"montage not work"fi
su pi -c "umount $monPath"
[^] # Re: utiliser eval ?
Posté par EauFroide . En réponse au message [RÉSOLU] Bash utiliser variable dans une commande du style result=$(commande | grep $variable). Évalué à 1.
Je viens de tester avec le code suivant et ça fonctionne
FONCTIONNE
NE FONCTIONNE PAS
Donation Bitcoin : 1N8QGrhJGWdZNQNSspm3rSGjtXaXv9Ngat