We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,571 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

adding 1 to a variable

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.

2
Contributors
1
Reply
3 Hours
Discussion Span
5 Months Ago
Last Updated
4
Views
Question
Answered
Garrett85
Posting Pro in Training
428 posts since Oct 2009
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0

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

L7Sqr
Practically a Posting Shark
867 posts since Feb 2011
Reputation Points: 253
Solved Threads: 155
Skill Endorsements: 7
Question Answered as of 5 Months Ago by L7Sqr

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0671 seconds using 2.67MB