How to Increment and Decrement Variable in Bash

Posted by linuxize on Aug 12, 2019 2:47 AM EDT
Linuxize.com
Mail this story
Print this story

One of the most common arithmetic operations when writing Bash scripts is incrementing and decrementing variables. This is most often used in loops as a counter, but it can occur elsewhere in the script as well. Incrementing and Decrementing means adding or subtracting a value (usually 1), respectively, from the value of a numeric variable. In Bash, there are multiple ways to increment/decrement a variable. This article explains some of them.



Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: GNU, Linux

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.