The content of file:
$ cat count.txt
0
This is my script:
counter=`cat count.txt`
value=`let counter++`
echo $value > count.txt
But the syntax is wrong...
Could you help me over this thread? How can I increase counter and echo it to file?
You can use BASH's (( and ))
construct for arithmetic operations:
echo 0 > count.txt
counter=$(<count.txt)
((counter++))
echo $counter > count.txt
cat count.txt
1
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments