Hi everyone!
I have a question.
How can I limit the length of a variable?
If its bigger than 9 for example to stop sa script from running.
Hi,
if $var ist your variable, ${#var} will give you the length
of the content of ${var}. So to stop your script try a
test like the one below:
if [[ ${#var2} -gt 9 ]]
then
echo "too big"
exit 1
else
echo "just fine"
fi
HTH Chris
sorry I wasn't to explicit.
I just need the length of the name of that varable and not the content.thanks
expr length string