Numéro incrémentiel en script shell sur chaque boucle
#!/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
Intérieur de la boucle for comment puis-je incrément P_CUST_ORDER_REF par 1 à chaque fois qu'il boucles
so it READs 10000028 uses it on first loop
2nd 10000029
3rd 10000030
4th 10000031
OriginalL'auteur ahmet | 2012-06-12
Vous devez vous connecter pour publier un commentaire.
ou
OriginalL'auteur Prince John Wesley
: $(( P_CUST_ORDER_REF += 1 ))
ou utiliser un++
de l'opérateur.OriginalL'auteur mouviciel
Vous pouvez utiliser la post-incrémentation de l'opérateur:
Je recommande:
-r
à lire pour éviter les barres obliques inverses d'être interprété comme s'échappePar exemple:
OriginalL'auteur Dennis Williamson