1,105,332 Community Members

adding 1 to a variable

Member Avatar
lewashby
Posting Pro
559 posts since Oct 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

The following line of code should result in GROUPS holding a number from 1 to probably 4 or 5. I need the next line to simply add 1 to whatever this lines results to. I've tried a lot of tings in bash but I can't make it happen. Any ideas? Thanks. GROUPS=$( expr ${NUMBEROFDIGITS} / 3 )

I thought it would be as simple as ${GROUPS}=${GROUPS+1} or }+1 but nothing I've tried has worked.

Member Avatar
L7Sqr
Veteran Poster
1,006 posts since Feb 2011
Reputation Points: 179 [?]
Q&As Helped to Solve: 168 [?]
Skill Endorsements: 11 [?]
 
0
 

Try GROUPS=$(($GROUPS + 1))
I'm not near a terminal so the syntax may be slightly different

Question Answered as of 1 Year Ago by L7Sqr
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article