有人可以告诉我我在set flag1做错了什么..我收到了flag1的错误:未定义的变量。
if($notLoaded1 > 0) then
echo "Rows not loaded due to data errors in first load: $notLoaded1"
set flag1=1
endif
if($notLoaded2 > 0) then
echo "Rows not loaded due to data errors in second load: $notLoaded2"
set flag2=1
endif
if($notLoaded3 > 0) then
echo "Rows not loaded due to data errors in third load: $notLoaded3"
set flag3=1
endif
echo $flag1
echo $flag2
echo $flag3
有没有办法在一个if语句中检查所有三个,而不是使用3个if语句
if ($flag1 > 0) then
exit 1
endif
if ($flag2 > 0) then
exit 1
endif
if ($flag3 > 0) then
exit 1
endif
谢谢
答案 0 :(得分:0)
flag1
大于0才会设置 $notLoaded1
。因此,如果它为零,则不会获得$ flag1。
我建议事先用默认值初始化这三个变量:
set flag1=0
if (...) the
set flag1=1
echo 'Rows not loaded...'
endif
这将保证flag1始终存在。
答案 1 :(得分:0)
你需要3个标志变量?
set error=0
if ($notLoaded1 > 0) then
echo "Rows not loaded due to data errors in first load: $notLoaded1"
set error=1
endif
if ($notLoaded2 > 0) then
echo "Rows not loaded due to data errors in second load: $notLoaded2"
set error=1
endif
if ($notLoaded3 > 0) then
echo "Rows not loaded due to data errors in third load: $notLoaded3"
set error=1
endif
if ($error) then
exit 1
endif