for file in *.json;do jq -r '.rows[] | [.[]] | @csv'"$file";done > $F_CALLS
}
function compressData(){
echo"Compressing data..."
tar -czf $F_TAR_GZ$F_CALLS
}
function cleanTempFiles(){
echo"Cleaning temporary files..."
rm -f ./*.json $F_COOKIES
}
function errorHandler(){
echo"Error: ($1) occurred on line $2"
cleanTempFiles
exit1
}
trap'errorHandler $? $LINENO' ERR
trap"echo -e '\nTerminated by Ctrl+c'; cleanTempFiles; exit" INT
for element in "${APP[@]}";do
[ -z "$(whereis -b "$element"| awk {'print$2'})"]&& errorHandler "$element - Maybe it is not installed on the system. Sorry but I can't continue""$LINENO"
done
if[ -z ${COOKIE+x}];then
echo"Manual cookie is unset";
getCookies;
else
echo"Manual cookie is set. Skipping get cookie step";