samedi 2 avril 2016

If command not outputting correct answer

Im making a bbs from scratch in bash, but i cant seem to get the login working: If is lying to me.

#!/bin/bash
echo "Enter user id:"
read id
if [ $id > $(cat /bbs/howmanyusers) ]; then
        echo "ERROR: non existant user!"
        exit
fi
#The rest of the script in unimportant in this case.

Whatever i input, it always outpus ERROR: non existant user! and exits. The output of cat /bbs/howmanyusers is 2.

Help?

Aucun commentaire:

Enregistrer un commentaire