I have a txt file with ONLY inside; it can be any number, how can I read it from bash and convert it to int?
As I said, the only thing in the file is the number, nothing else, but reading it, bash gets it as a string.
Thanks in advance!
Use declare or typeset :
declare
typeset
typeset -i variable=$(cat filename)
Source: https://habr.com/ru/post/1491471/More articles:Intel Compiler - error: identifier "alignof" - undefined - c ++Problems finding Grabkit header paths - header-filesHeroku facebook login "One or more of the given URLs is not allowed by the application settings." - authenticationReading a private encrypted key in Java - javaHow can I remove a carriage return from a text file using Python? - pythonIn the facebook canvas application, where can I send the signed request parameter as soon as I captured it in the log - phpThe regular expression '<>' validation - regexAvailability of a list with English words (including frequencies)? - pythonDjango says my model is undefined - pythonWill apps built for iOS 6 or earlier work seamlessly in iOS 7? - iosAll Articles