First thing I would say is to be consistent with your information. Initially you have advised the value in the file will be '09', but when you reset the value it will be '9' ... why not '09'?
As for your current code, you have a few issues:
1. It is recommended in bash to use [[]] over [] (see
here for more details)
2. cat "$Counter" - This will output data to the screen and is not for being tested. You would need to use process substitution and prefer $() over `` (see
here for more details)
3. 9 is not a command and hence cannot be redirected anywhere. Think of what command you would use to show a 9 on screen
4. $ is not used on the left of the equals sign in general. If it were, you would be saying the following:
Code:
/home/Counter="..."
5. "`cat $Counter`+1" :- see previous information on using $() instead, but this is still wrong as it will return a string as follows (assuming '09' is in file)
Code:
Counter="09 + 1"
echo $Counter
09 + 1
As you can see the above is not the desired output or affect
6. Further to the above, you need to look up the use of either the 'let' command or (()), I prefer the latter as easy to spot in code and a little clearer
Let us know how you get on