Originally Posted by yhus
I can use a "read" command to read a file in bash script
Not exactly, read is meant to read one ore more variables from the shell standard input.
The standard input can be a file with redirections or a pipe though.
The "command" to read a file with the shell is
This command is mostly useless, as nothing is done with the file.
Another way to read a file with the shell can be:
Then, you'll have everything the file contains in the "content" variable.
is there a "write" command I can write a value to the file? If not, how can I write a numerical value to a file?
There are plenty of ways, here is one:
printf "%.2f\n" $value >> /tmp/somefile