我遵循用windows bacth文件编写的代码。需要将相同的内容转换为shell脚本。请帮助.Es-特别需要在shell脚本中使用for循环,它无法在shell脚本{{1}中实现}
enter code here
)
for /F "tokens=1,3 delims=:[]" %%A in (%LOG_DIR%\PM_IS_workflow_status.log) do (
set "ATTR_NAME=%%A"
if /i "!ATTR_NAME!" EQU "Folder" (
set FLD_NAME=%%B
)
if /i "!ATTR_NAME!" EQU "Workflow" (
set WKF_NAME=%%B
)
if /i "!ATTR_NAME!" EQU "Workflow run status" (
set WKF_STAT=%%B
echo !WKF_STAT! | findstr /I /C:"terminat"
set ERR_CODE=!errorlevel!
if !ERR_CODE!==0 (
echo !FLD_NAME!,!WKF_NAME!,!WKF_STAT! >> %LOG_DIR%\PM_wkf_status.csv
set "EMAIL_FL=Y"
)