vendredi 29 avril 2016

Bash script if -eq

New to bash script, i need to check if the first word in Group equals the second word in Users.

Group=`echo $rules | egrep -v 'Test'`
Users=`echo $rules | grep -i 'Test' | awk '{print substr($0, index($0,$2))}'`

if [ '$Group' -eq '$Users' ];
then
echo $Group
echo $Users

else
:
fi

Can I use something like this or how is this possible?

if [ '$Group $1' -eq '$Users $2' ];

or

if [ '^$Group' -eq '^$Users' ];

Aucun commentaire:

Enregistrer un commentaire