加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

bash – 每个循环中shell脚本中的增量编号

发布时间:2020-12-15 22:24:10 所属栏目:安全 来源:网络整理
导读:#!/bin/bashecho SCRIPT: $0echo "Enter Customer Order Ref (e.g. 100018)"read P_CUST_ORDER_REFecho "Enter DU Id (e.g. 100018)"read P_DU_IDP_ORDER_ID=${P_CUST_ORDER_REF}${P_DU_ID}#Loop through all XML files in the current directoryfor f in *.
#!/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

在for循环中,如何在每次循环时将P_CUST_ORDER_REF递增1

so it READs 10000028 uses it on first loop
2nd 10000029
3rd 10000030
4th 10000031

解决方法

((P_CUST_ORDER_REF+=1))

要么

let P_CUST_ORDER_REF+=1

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读