Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incremental number in shell script on each loop

Tags:

bash

shell

#!/bin/bash

echo SCRIPT: $0
echo "Enter Customer Order Ref (e.g. 100018)"
read P_CUST_ORDER_REF
echo "Enter DU Id (e.g. 100018)"
read P_DU_ID

P_ORDER_ID=${P_CUST_ORDER_REF}${P_DU_ID}


#Loop through all XML files in the current directory
for f in *.xml
do
  #Increment P_CUST_ORDER_REF here
done

Inside the for loop how can i increment P_CUST_ORDER_REF by 1 every time it loops

so it READs 10000028 uses it on first loop
2nd 10000029
3rd 10000030
4th 10000031
like image 384
ahmet Avatar asked Dec 06 '22 14:12

ahmet


1 Answers

((P_CUST_ORDER_REF+=1))

or

let P_CUST_ORDER_REF+=1
like image 130
Prince John Wesley Avatar answered Dec 30 '22 00:12

Prince John Wesley