1. 程式人生 > >Shell指令碼常用命令整理

Shell指令碼常用命令整理

該筆記主要整理了一些常見的指令碼操作命令,大致如下(持續補充中):

1. while、for迴圈

 

1. while、for迴圈

#!/bin/bash

# while迴圈

v_start_date=${v_start_date}
v_end_date=${v_end_date}

while [ ${v_start_date} -le ${v_end_date} ]
do
..
done

# for迴圈
# 方法一:
# 日期變數定義
v_array_w=("20200429" "20200506" "20200513" "20200520" "20200527")
for dayno in ${v_array_w[@]};
do
echo ${dayno}
done

# 方法二:
for dayno in {"20200429","20200506","20200513","20200520","20200527"}
do
echo ${dayno}
done

&n