1

Calculate variable, and output it to another variable

view story
linux-howto

http://unix.stackexchange.com – The only calculator I know is bc. I want to add 1 to a variable, and output to another variable. I got the nextnum variable from counting string in a file: nextnum=`grep -o stringtocount file.tpl.php | wc -w` Lets say the nextnum value is 1. When added with 1, it will become 2. To calculate, I run: rownum=`$nextnum+1 | bc` but got error: 1+1: command not found I just failed in calculation part. I've tried changing the backtick but still not works. I have no idea how to calculate variables and output it to another variable. (HowTos)