I am looking for an approach to build a script.
I have 3 files with the below pattern:
DailyLoad_Cust.txt
DailyLoad_Credit.txt
DailyLoad_Account.txt
Each of these files has an associated sub_system.
e.g cust has cus_edw, credit has cred_edw and account has acc_edw.
There is a common load script RunFeed.sh <<sub_system>> which takes sub_system (cus_edw,cred_edw, or acc_edw) and runs if the file is available at NAS location and has count > 0.
What's the best approach I can use for this?
$Var1="Cust"
$Var2="Credit"
$var3="Account"
SUB_SYSTEM="";
for i in $VAR1; do
NASFileCount=`find . -maxdepth l -type f -name "${var}*.txt" | wc -l
if [[ $NASFileCount -gt 0 ]] && $Var1=cust;then
Sub_System=cust_edw
sh RunFeed.sh $Var
In the above approach (which is raw and not run so far), how can I run the loop for all the variables above?
Can anyone please guide me, there is any better approach? I am relatively new to Unix, still learning.
sh RunFeed.sh account_edwif the fileDailyLoad_Account.txtis available in the current directory"?