Increment of a variable

Hi All,

I have a variable n that stores a number.
Eg. echo $n comes out to be 120.

I need to print 121 using echo command on n.
Please advice.

Thanks in advance !!

Use let or $(( .. ))

n=$((n + 1))

Or just to echo:

echo $((n + 1))

Hi All,

I need to insert 400 spaces after a variable in a file.
Eg. if n=T12345
echo $n >> file_name
I need to insert 400 spaces after n in the file "file_name".

Please advice.

Thanks in advance !!

---------- Post updated at 09:01 PM ---------- Previous update was at 08:55 PM ----------

Thanks Scottn !!

What scripting language are you using? Can you post any code you've tried already?

You really should open a new thread for new questions.

printf "$n%400s" >> file_name

If you ask any more off-topic questions, I suggest you start a new thread.