Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(portal): fix SC2045-ShellCheck #14

Open
wants to merge 4 commits into
base: v0.2.2-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(portal): fix SC2045-ShellCheck "Iterating over ls output is fragi…
…le. Use globs."
  • Loading branch information
Houlong66 committed Aug 17, 2022
commit 957bc051ffa4a2cab8b5a0739c3ebb52caf7f1f0
19 changes: 10 additions & 9 deletions appactive-portal/baseline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,21 @@ if [ `expr $type % 2` == 0 ]
then
if [ $channel = "FILE" ]
then
for file in $(ls ../appactive-demo/data/); do
for file in ../appactive-demo/data/; do
[[ -e "$file" ]] || break
if [[ "$file" == *"path-address"* ]]; then
echo "continue"
continue
fi
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file} 基线推送中";
cp -f ./rule/idSource.json "../appactive-demo/data/$file/"
cp -f ./rule/transformerBetween.json "../appactive-demo/data/$file/idTransformer.json"
cp -f ./rule/idUnitMapping.json "../appactive-demo/data/$file/"
cp -f ./rule/dbProperty.json "../appactive-demo/data/$file/mysql-product"
arr=(${file//-/ })
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file##*/} 基线推送中";
cp -f ./rule/idSource.json "$file/"
cp -f ./rule/transformerBetween.json "$file/idTransformer.json"
cp -f ./rule/idUnitMapping.json "$file/"
cp -f ./rule/dbProperty.json "$file/mysql-product"
arr=(${${file##*/}//-/ })
unitFlag=${arr[1]}
echo "{\"unitFlag\":\"${unitFlag}\"}" > "../appactive-demo/data/$file/machine.json"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file} 基线推送完成"
echo "{\"unitFlag\":\"${unitFlag}\"}" > "$file/machine.json"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file##*/} 基线推送完成"
done
elif [ $channel = "NACOS" ]
then
Expand Down
24 changes: 13 additions & 11 deletions appactive-portal/cut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ idUnitMappingNextFile="idUnitMappingNext.json"

if [ $channel = "FILE" ]
then
for file in $(ls ../appactive-demo/data/); do
for file in ../appactive-demo/data/*; do
[[ -e "$file" ]] || break
if [[ "$file" == *"path-address"* ]]; then
echo "continue"
continue
fi
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file} 禁写规则推送中)"
cp -f ./rule/$forbiddenFile "../appactive-demo/data/$file/forbiddenRule.json"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file} 禁写规则推送完成"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file##*/} 禁写规则推送中)"
cp -f ./rule/$forbiddenFile "$file/forbiddenRule.json"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file##*/} 禁写规则推送完成"
done
elif [ $channel = "NACOS" ]
then
Expand Down Expand Up @@ -74,17 +75,18 @@ echo "数据已经追平,下发新规则......"

if [ $channel = "FILE" ]
then
for file in $(ls ../appactive-demo/data/); do
for file in ../appactive-demo/data/*; do
[[ -e "$file" ]] || break
if [[ "$file" == *"path-address"* ]]; then
echo "continue"
continue
fi
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file} 新规则推送中"
cp -f ./rule/$idUnitMappingNextFile "../appactive-demo/data/$file/idUnitMapping.json"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file} 新规则推送完成"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file} 清除禁写规则推送中)"
cp -f ./rule/$forbiddenFileEmpty "../appactive-demo/data/$file/forbiddenRule.json"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file} 清除禁写规则推送完成"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file##*/} 新规则推送中"
cp -f ./rule/$idUnitMappingNextFile "$file/idUnitMapping.json"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file##*/} 新规则推送完成"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file##*/} 清除禁写规则推送中)"
cp -f ./rule/$forbiddenFileEmpty "$file/forbiddenRule.json"
echo "$(date "+%Y-%m-%d %H:%M:%S") 应用 ${file##*/} 清除禁写规则推送完成"
done
elif [ $channel = "NACOS" ]
then
Expand Down