Current location - Training Enrollment Network - Mathematics courses - How to add 1 to a variable in a shell script?
How to add 1 to a variable in a shell script?
There are six ways to add variables to a shell script:

1, the first incremental way of integer variables.

a=$(($a+ 1))?

Echo? $a?

2. The second self-increasing method of integer variables a=$[$a+ 1]?

Echo? $a?

3. The third self-increasing method of integer variables a=`expr? $a? +? 1` ?

Echo? $a?

4. the fourth self-increasing method of integer variables let? a++?

Echo? $a?

5. let, the fifth self-increasing method of integer variables? a+= 1?

Echo? One dollar

6. The sixth incremental way of integer variables ((a++))?

Echo? One dollar

Extended data:

Basically, shells fall into two categories:

1, graphical user interface shell (GUI shell)

The most widely used windows Explorer (Microsoft's windows operating system) also includes well-known Linux shell, including X window manager (BlackBox and FluxBox) and more powerful CDE, GNOME, KDE and XFCE.

2. Command line interface shell (CLI shell).

Bash/sh/ksh/csh/zsh(Unix/linux system), cmd.exe/ command prompt (Windows NT system), Windows PowerShell (Windows NT system support. NET framework technology), the shell in the traditional sense refers to the command line shell, unless otherwise specified, the future shell refers to the command line shell.