I have a txt file with ONLY a number inside; it can be any number, how can i read it from bash and convert it into an int?
As i said, the only thing in the file is the number, no other thing, but when reading it, bash gets it as a string.
Thanks in advance!
Use declare
or typeset
:
typeset -i variable=$(cat filename)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With