I Irishgent macrumors newbie Original poster Nov 14, 2002 8 0 Nov 22, 2002 #1 I just want to increment the value of a variable in a shell script. I have tried count = count + 1 Anyone got any ideas.
I just want to increment the value of a variable in a shell script. I have tried count = count + 1 Anyone got any ideas.
bousozoku Moderator emeritus Jun 25, 2002 16,598 2,949 Lard Nov 23, 2002 #2 It depends on the shell. Bourne shell (sh): count='expr $count + 1' C shell (csh): @ count += 1 or @ count++ Bourne again shell (bash): count = count + 1 The sh form should work with Korn shell (ksh) and the csh form should work with Tcsh.
It depends on the shell. Bourne shell (sh): count='expr $count + 1' C shell (csh): @ count += 1 or @ count++ Bourne again shell (bash): count = count + 1 The sh form should work with Korn shell (ksh) and the csh form should work with Tcsh.
I Irishgent macrumors newbie Original poster Nov 14, 2002 8 0 Nov 25, 2002 #3 while, if syntax for tcsh I want to make a while loop so in for tcsh. What is the correct syntax. set count = 1 set max = 5 while (count < max) do increment count by one done
while, if syntax for tcsh I want to make a while loop so in for tcsh. What is the correct syntax. set count = 1 set max = 5 while (count < max) do increment count by one done