Reputation: 3407
Trying to check if the length of a string is less than 7. I figured the following code should work just fine, but its not. Whats wrong?
if [ ${#certid} -lt 5] ; then
echo "[!] invalid ID"
exit
fi
Upvotes: 0
Views: 1235
Reputation: 70929
You have several problems:
certid
is less than 5 instead of if it is longer than 5. Use gt
instead of lt
]
Upvotes: 2